Responsive
Magento UI library provides a strong approach for working with media queries. It`s based on recursive call of .media-width()
lib/web/css/source/lib/_responsive.less
styles.css
we have every media query only once with all the rules there, not a multiple calls for the same query.
To see the media queries work resize window to understand which breakpoint is applied.
.example-responsive-block {
padding: 10px;
}
.media-width(@extremum, @break) when (@extremum = 'max') and (@break = @screen__m) {
.example-responsive-block {
background: #ffc;
}
.example-responsive-block:before {
content: 'Mobile styles ';
font-weight: bold;
}
}
.media-width(@extremum, @break) when (@extremum = 'min') and (@break = @screen__m) {
.example-responsive-block {
background: #ccf;
}
.example-responsive-block:before {
content: 'Desktop styles ';
font-weight: bold;
}
}