Chapter 8: Applying CSS Conditionally
Conditional CSS refers to CSS rules that are applied when a condition is met. A condition may be a CSS property and value combination, as with the @supports
rule. A condition may test for a browser window condition such as width, as with the @media
rule. Or a condition may be a device feature such as hover capability or pointer input, as with some newer features of @media
. We’ll discuss all of the above in this chapter.
Both @media
and @supports
are described by the CSS Conditional Rules Module Level 3 specification. The @media
rule—which you probably know as media queries—is fully defined by the Media Queries specification.
Media Queries and @media
The @media
rule is actually a long-standing feature of ...
Get CSS Master, 2nd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.