Skip to content

Instantly share code, notes, and snippets.

@jcutrell
Created June 28, 2013 19:40
Show Gist options
  • Save jcutrell/5887473 to your computer and use it in GitHub Desktop.
Save jcutrell/5887473 to your computer and use it in GitHub Desktop.
Named media queries with .lt and .gt classes
// named media queries - http://blog.scur.pl/2012/06/variable-media-queries-less-css/
@highdensity: ~"only screen and (-webkit-min-device-pixel-ratio: 1.5)",
~"only screen and (min--moz-device-pixel-ratio: 1.5)",
~"only screen and (-o-min-device-pixel-ratio: 3/2)",
~"only screen and (min-device-pixel-ratio: 1.5)";
@600: ~"only screen and (min-width: 600px)";
@800: ~"only screen and (min-width: 800px)";
@1000: ~"only screen and (min-width: 1000px)";
@1200: ~"only screen and (min-width: 1200px)";
@lt600: ~"only screen and (max-width: 601px)";
@lt800: ~"only screen and (max-width: 801px)";
@lt1000: ~"only screen and (max-width: 1001px)";
@lt1200: ~"only screen and (max-width: 1201px)";
.lt {
&600 {
@media @600 {
display: none;
}
}
&800 {
@media @800 {
display: none;
}
}
&1000 {
@media @1000 {
display: none;
}
}
&1200 {
@media @1200 {
display: none;
}
}
}
.gt {
&600 {
@media @lt600 {
display: none;
}
}
&800 {
@media @lt800 {
display: none;
}
}
&1000 {
@media @lt1000 {
display: none;
}
}
&1200 {
@media @lt1200 {
display: none;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment