You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Mária Jurčovičová edited this page Mar 6, 2015
·
1 revision
Media merging happens when the compiler encounters media nested directly into another media. Whatever is written inside nested media is applied only if both inner and outer media queries are satisfied. It is very similar to rulesets nesting: outer media is compiled as usually, nested media make no difference to it. Inner media queries are combined with outer media queries.
Sample input:
@mediaprint {
.class {
margin: 3333;
color: black;
@media (max-width: 117px) { // margin should be smaller in small mediamargin: 1111;
}
}
}
compiles into:
@mediaprint {
.class {
margin: 3333;
color: black;
}
}
@mediaprintand (max-width: 117px) { // print on small media should use smaller margin.class {
margin: 1111;
}
}
Any media can describe multiple mediums. If this is the case, then each medium query described by inner media type is combined with each medium query described by outer media:
CSS specification allows only one media type inside each media query. That media type can be followed by any number of media expressions joined by "and". If inner media type starts with a media type, resulting less style sheet is invalid. Such input is treated differently by less4j and less.js.
Less.js combines inner and outer media queries as they are and thus produce invalid CSS. Less4j ignores media type in inner media query and produces a warning.