Skip to content

Instantly share code, notes, and snippets.

@thekarel
Created September 2, 2013 13:26
Show Gist options
  • Save thekarel/6412843 to your computer and use it in GitHub Desktop.
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
// 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;
}
}
@thekarel
Copy link
Author

thekarel commented Sep 2, 2013

Thanks @jamtat

@jamtat
Copy link

jamtat commented Sep 2, 2013

Sweeeet

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment