Skip to content

Instantly share code, notes, and snippets.

@yankeyhotel
Last active August 29, 2015 14:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yankeyhotel/be4ec9d1b6e33b772f70 to your computer and use it in GitHub Desktop.
Save yankeyhotel/be4ec9d1b6e33b772f70 to your computer and use it in GitHub Desktop.
A nicer way of doing @media queriers in Less
// @media queries vars
// @mq-xxs - [ 0px - 480px]
// @mq-xs - [ 481px - 767px]
// @mq-sm - [ 768px - 991px]
// @mq-md - [ 992px - 1199px]
// @mq-lg - [1200px +]
@mq-xxs: ~"only screen and (max-width: @{screen-xs})";
@mq-xs: ~"only screen and (min-width: @{screen-xs} + 1) and (max-width: @{screen-xs-max})";
@mq-sm: ~"only screen and (min-width: @{screen-sm}) and (max-width: @{screen-sm-max})";
@mq-md: ~"only screen and (min-width: @{screen-md}) and (max-width: @{screen-md-max})";
@mq-lg: ~"only screen and (min-width: @{screen-lg})";
@mq-xs-plus: ~"only screen and (min-width: @{screen-xs})"; // 480px +
@mq-sm-plus: ~"only screen and (min-width: @{screen-sm})"; // 768px +
@mq-md-plus: ~"only screen and (min-width: @{screen-md})"; // 992px +
// how to use
@media @mq-xs {
color: red;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment