Created
February 11, 2015 07:41
-
-
Save Frique/b94f285ea6014398bbf6 to your computer and use it in GitHub Desktop.
Aspect ratio mixin
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
/* Source: http://css-tricks.com/snippets/sass/maintain-aspect-ratio-mixin/ */ | |
@mixin aspect-ratio($width, $height) { | |
position: relative; | |
&:before { | |
display: block; | |
content: ""; | |
width: 100%; | |
padding-top: ($height / $width) * 100%; | |
} | |
> .content { | |
position: absolute; | |
top: 0; | |
left: 0; | |
right: 0; | |
bottom: 0; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment