Created
December 3, 2012 10:32
-
-
Save pixelistik/4194120 to your computer and use it in GitHub Desktop.
CSS snippets
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
/* === Keep ratio of a container fixed === */ | |
/* http://www.alistapart.com/articles/creating-intrinsic-ratios-for-video/ */ | |
.wrapper-with-intrinsic-ratio { | |
position: relative; | |
padding-bottom: 20%; | |
height: 0; | |
} | |
.element-to-stretch { | |
position: absolute; | |
top: 0; | |
left: 0; | |
width: 100%; | |
height: 100%; | |
background: teal; | |
} | |
/* === Pass media query to javascript with invisible content === */ | |
/* http://adactio.com/journal/5429/ */ | |
@media all and (min-width: 45em) { | |
body:after { | |
content: 'widescreen'; | |
display: none; | |
} | |
} | |
/* Then, in Javascript: | |
var size = window.getComputedStyle(document.body,':after').getPropertyValue('content'); | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment