Last active
August 29, 2015 14:15
-
-
Save andipaetzold/0fe447ba9ae0476edd65 to your computer and use it in GitHub Desktop.
Container with fixed aspect ratio. Size is based on the current viewport.
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
$ratio-height: 3; | |
$ratio-width: 4; | |
$margin: 0.1; | |
div#selector { | |
width: (1 - $margin) * 100vw; | |
height: (1 - $margin) * $ratio-height / $ratio-width * 100vw; | |
max-height: (1 - $margin) * 100vh; | |
max-width: (1 - $margin) * $ratio-width / $ratio-height * 100vh; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment