Last active
August 29, 2015 14:01
-
-
Save joetemp/82239d2df382cf829ba1 to your computer and use it in GitHub Desktop.
A mixin that maintains aspect ratio and always stays centered. You simply feed it a width and an aspect ratio.
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
| @mixin center_aspect($width, $aspect) { | |
| width: $width; | |
| $height: $width * $aspect; | |
| height: $height; | |
| max-height: 90%; | |
| left: 50%; | |
| top: 50%; | |
| margin-left: - ($width / 2); | |
| margin-top: - ($height / 2); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment