Skip to content

Instantly share code, notes, and snippets.

@lukasholzer
Last active February 9, 2017 10:08
Show Gist options
  • Save lukasholzer/85ec8ed431e058f55111b2d97539a386 to your computer and use it in GitHub Desktop.
Save lukasholzer/85ec8ed431e058f55111b2d97539a386 to your computer and use it in GitHub Desktop.
SCSS Mixin for aspect ratios
@mixin aspect-ratio($width, $height) {
position: relative;
display: block;
width: 100%;
padding-top: ($height / $width) * 100%;
&:before {
display: block;
content: "";
width: 100%;
padding-top: ($height / $width) * 100%;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment