Media queries are grouped with each module/element/selector. Have to repeat the properties in each MQ, and often write a MQ just to declare the one property that will change.
@tablet: 768px;
@desktop-sm: 992px;
@desktop-lg: 1200px;
.hero-main-heading {
position: absolute;
top: 20px;
left: 0;
color: #fff;
margin-top: 20px;
margin-bottom: 40px;
width: 100%;
display: none;
@media (min-width: @tablet) {
display: block;
position: absolute;
max-width: 85%;
bottom: 340px;
left: 145px;
top: auto;
}
@media (min-width: @desktop-sm) { bottom: 280px; }
@media (min-width: @desktop-lg) { bottom: 360px; }
}
Each CSS property can have an object with a set of media query / value pairs. In this example, media queries are expressed as variables. Still cumbersome to write the variables every time.
.hero-main-heading {
position: absolute;
top: 20px;
left: 0;
color: #fff;
margin-top: 20px, {
@tablet: 40px,
@desktop-sm: 340px
};
margin-bottom: 40px;
width: 100%;
display: none, {
@tablet: block
};
bottom: auto, {
@tablet: 50px,
@desktop-sm: 340px,
@desktop-lg: 360px
};
}
Each CSS property can have an object with a set of media query / value pairs, but the order determines which media query each value corresponds to, rather than having to write them each time.
+mediaSetting = min-width;
+mediaQueries = { @tablet, @desktop-sm, @desktop-lg };
.hero-main-heading {
position: absolute;
top: 20px;
left: 0;
color: #fff;
margin-top: 20px, { 40px, 340px };
margin-bottom: 40px;
width: 100%;
display: none, { block };
bottom: auto, { 50px, 340px, 360px };
}