Skip to content

Instantly share code, notes, and snippets.

@timhettler
Created July 9, 2014 15:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save timhettler/e9dd1bb8f1611c81f92b to your computer and use it in GitHub Desktop.
Save timhettler/e9dd1bb8f1611c81f92b to your computer and use it in GitHub Desktop.
Generated by SassMeister.com.
<div class="background"></div>
// ----
// Sass (v3.3.9)
// Compass (v1.0.0.alpha.20)
// ----
@mixin ratio($width, $height) {
&:before {
content: '';
display: block;
padding-bottom: percentage($height / $width);
}
}
.background {
@include ratio(25,10);
max-width: 50%;
margin: 0 auto;
&:before {
background: red;
}
}
.background {
max-width: 50%;
margin: 0 auto;
}
.background:before {
content: '';
display: block;
padding-bottom: 40%;
}
.background:before {
background: red;
}
<div class="background"></div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment