This seems to be the hyper-specific case that appears to be misbehaving in Sass and partially vague expectations.
Sass handles nesting in conjunction with comma-delimited messages without any problems ... until you start specifying the display type in both the internal and the external request:
.foo { @media (min-width: 20em) { color: yellow; @media all and (max-width: 40em), (orientation: portrait) { color: green; } } } .bar { @media screen and (min-width: 20em) { color: yellow; @media all and (max-width: 40em), (orientation: portrait) { color: green; } } } .buzz { @media only screen and (min-width: 20em) { color: red; @media all and (max-width: 40em) { color: blue; } } }
Output:
@media (min-width: 20em) { .foo { color: yellow; } } @media all and (min-width: 20em) and (max-width: 40em), (min-width: 20em) and (orientation: portrait) { .foo { color: green; } } @media screen and (min-width: 20em) { .bar { color: yellow; } } @media screen and (min-width: 20em) and (orientation: portrait) { .bar { color: green; } } @media only screen and (min-width: 20em) { .buzz { color: red; } }
In both cases, when the internal and external query contains the type of display (everything, the screen), the compiled results incorrectly correspond to what was written. This is similar to the case when Sass tries to write something similar to a valid media query (since he knows that screen and all invalid).
Thus, the display type is indicated only once.
.element { @media (min-width: 825px) and (max-width: 999px) { font-size: 10.4vw; @media all and (-ms-high-contrast: none), (-ms-high-contrast: active) { font-size: 9.6vw; } } }
Compiles:
@media (min-width: 825px) and (max-width: 999px) { .element { font-size: 10.4vw; } } @media all and (min-width: 825px) and (max-width: 999px) and (-ms-high-contrast: none), (min-width: 825px) and (max-width: 999px) and (-ms-high-contrast: active) { .element { font-size: 9.6vw; } }
source share