Skip to content

Instantly share code, notes, and snippets.

@DannyJoris
Created June 13, 2014 18:15
Show Gist options
  • Select an option

  • Save DannyJoris/855dcc377afdcd0a8d0d to your computer and use it in GitHub Desktop.

Select an option

Save DannyJoris/855dcc377afdcd0a8d0d to your computer and use it in GitHub Desktop.
Generated by SassMeister.com.
<div class='example'>
<ul>
<li class='stretch-container'>
<div id='stretch-full'>
This element is fully stretched.
</div>
</li>
<li class='stretch-container'>
<div id='stretch-offset'>
This element is stretched with a 1em offset on each side.
</div>
</li>
<li class='stretch-container'>
<div id='stretch-x'>
This
<br />
element
<br />
is
<br />
stretched
<br />
horizontally.
</div>
</li>
<li class='stretch-container'>
<div id='stretch-y'>
This
<br />
element
<br />
is
<br />
stretched
<br />
vertically.
</div>
</li>
</ul>
</div>
// ----
// Sass (v3.3.8)
// Compass (v1.0.0.alpha.19)
// ----
@import "compass/layout/stretching";
@import "compass/utilities";
@import "compass/css3";
.stretch-container {
border: 1px solid hotpink;
min-width: 200px;
height: 200px;
margin: 10px;
position: relative;
@include inline-block;
}
.stretched {
$stretch-color: hotpink;
border: 3px solid lighten($stretch-color, 15%);
@include border-radius(10px);
display: block;
background-color: $stretch-color;
color: white;
text-align: center;
vertical-align: middle;
padding: 15px;
}
#stretch-full {
@extend .stretched;
@include stretch;
}
#stretch-offset {
@extend .stretched;
@include stretch(1em, 1em, 1em, 1em);
}
#stretch-x {
@extend .stretched;
@include stretch-x;
}
#stretch-y {
@extend .stretched;
@include stretch-y;
max-width: 100px; // optional max-width
}
.stretch-container {
border: 1px solid hotpink;
min-width: 200px;
height: 200px;
margin: 10px;
position: relative;
display: inline-block;
vertical-align: middle;
*vertical-align: auto;
*zoom: 1;
*display: inline;
}
.stretched, #stretch-full, #stretch-offset, #stretch-x, #stretch-y {
border: 3px solid #ffb5da;
-moz-border-radius: 10px;
-webkit-border-radius: 10px;
border-radius: 10px;
display: block;
background-color: hotpink;
color: white;
text-align: center;
vertical-align: middle;
padding: 15px;
}
#stretch-full {
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
}
#stretch-offset {
position: absolute;
top: 1em;
bottom: 1em;
left: 1em;
right: 1em;
}
#stretch-x {
position: absolute;
left: 0;
right: 0;
}
#stretch-y {
position: absolute;
top: 0;
bottom: 0;
max-width: 100px;
}
<div class='example'>
<ul>
<li class='stretch-container'>
<div id='stretch-full'>
This element is fully stretched.
</div>
</li>
<li class='stretch-container'>
<div id='stretch-offset'>
This element is stretched with a 1em offset on each side.
</div>
</li>
<li class='stretch-container'>
<div id='stretch-x'>
This
<br />
element
<br />
is
<br />
stretched
<br />
horizontally.
</div>
</li>
<li class='stretch-container'>
<div id='stretch-y'>
This
<br />
element
<br />
is
<br />
stretched
<br />
vertically.
</div>
</li>
</ul>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment