same $breakpoints: ( 'phone': 320px, 'tablet': 768px, 'desktop': 1024px ) !default; // (...) .header__logo { // Using a custom value @include media('>550px') { display: block; } } // Mixing a custom value with a global breakpoint @include media('>desktop', '<1290px') { // Other rules here }
when condition A or condition B: // Chris Coyier's retina (2x) media query // https://css-tricks.com/snippets/css/retina-display-media-query/ @media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) { // Retina-specific stuff here } @media (condition-A), (condition-B) { // Some rules here } Example:
192dpi)' ) !default; // (...) @include media('>tablet', 'retina2x') { // Rules for retina device greater than tablet } @media (min-width: 768px) and (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) { // This is NOT what we wanted! } SCSS Resulting CSS a ∧ (b ∨ c) != (a ∧ b) ∨ c
and (min-resolution: 192dpi) { // This is what we want } @media (min-width: 768px) and (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) { // Oh this will go wrong... } What we want What we get a ∧ (b ∨ c) = (a ∧ b) ∨ (a ∧ c) (a ∧ b) ∨ c
default breakpoints and media expressions Prepare for the future of the interwebs @include media('>=watch') { // You have got to be kidding me... } Share your use cases, issues, requests and 쁥