Last active
June 18, 2018 19:10
-
-
Save GoodNew5/e9dfb1ff1359b45428e712f9807bbe30 to your computer and use it in GitHub Desktop.
aspect-ratio.scss
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; | |
&:before{ | |
display: block; | |
content: " "; | |
width: 100%; | |
padding-top: ($height / $width) * 100%; | |
} | |
} | |
// example: @include aspect-ratio(1,1); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment