Last active
February 9, 2017 10:08
-
-
Save lukasholzer/85ec8ed431e058f55111b2d97539a386 to your computer and use it in GitHub Desktop.
SCSS Mixin for aspect ratios
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@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