Created
October 31, 2018 13:22
-
-
Save mammuth/8890b2832fab165c4f3f64e0c92cc8fe to your computer and use it in GitHub Desktop.
Less aspect ratio mixin
This file contains hidden or 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
.m-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; | |
} | |
} | |
/* Usage: | |
* .my-wrapper { | |
* .m-aspect-ratio(16, 9); | |
* } | |
* Give child content in .content class | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Wow! Thanks for this..
godaddy domain at 99