Skip to content

Instantly share code, notes, and snippets.

@ifcanduela
Last active April 27, 2017 15:03
Show Gist options
  • Save ifcanduela/96465c2059b2185d62d9 to your computer and use it in GitHub Desktop.
Save ifcanduela/96465c2059b2185d62d9 to your computer and use it in GitHub Desktop.
Responsive breakpoints using LESS variables
///////////////////////////////////////////////////////////////////////////////
// RESPONSIVE BREAKPOINTS
@xs: 640px;
@xs_plus_one: (@xs + 1px);
@sm: 768px;
@sm_plus_one: (@sm + 1px);
@md: 992px;
@md_plus_one: (@md + 1px);
@lg: 1200px;
@lg_plus_one: (@lg + 1px);
// main breakpoints
@to_xs: ~"(max-width: @{xs})";
@from_xs: ~"(min-width: @{xs_plus_one})";
@to_sm: ~"(max-width: @{sm})";
@from_sm: ~"(min-width: @{sm_plus_one})";
@to_md: ~"(max-width: @{md})";
@from_md: ~"(min-width: @{md_plus_one})";
@to_lg: ~"(max-width: @{lg})";
@from_lg: ~"(min-width: @{lg_plus_one})";
// ranges
@from_xs_to_sm: ~"@{from_xs} and @{to_sm}";
@from_xs_to_md: ~"@{from_xs} and @{to_md}";
@from_xs_to_lg: ~"@{from_xs} and @{to_lg}";
@from_sm_to_md: ~"@{from_sm} and @{to_md}";
@from_sm_to_lg: ~"@{from_sm} and @{to_lg}";
@from_md_to_lg: ~"@{from_md} and @{to_lg}";
@winsoor
Copy link

winsoor commented Apr 27, 2017

Thank you! Bro!

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