Created
September 2, 2013 13:26
-
-
Save thekarel/6412843 to your computer and use it in GitHub Desktop.
In-line media queries in LESS, with variables
From http://lesscss.org/#-operations
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
// You can define variables to be used in media queries | |
@singleQuery: ~"(max-width: 500px)"; | |
@media screen, @singleQuery { | |
set { | |
padding: 3 3 3 3; | |
} | |
} | |
// Which can lead to inline media queries that use variables for targets | |
@device1: ~'min-width: 768px AND max-width: 999px'; | |
#beef-melt { | |
color: green; | |
@media (@device1) { | |
color: red; | |
} | |
} | |
// And this will compile to | |
#beef-melt { | |
color: green; | |
} | |
@media (min-width: 768px AND max-width: 999px) { | |
#beef-melt { | |
color: red; | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks @jamtat