Anatomy of a media query

I'm going to put all the media queries at the bottom of the style sheet. You don't have to do this, but that's what I'll do. Media queries always start with @media. Then, they have two parts. The first part is the media type. For example:

@media screen

You could plug in print , screen, all and a few other options as well. print would only be applied to print style sheets, whereas, screen would only be applied to computer screens (but not print outs). all would apply to both. If we left out the media type altogether - which is perfectly acceptable - it defaults to all.

The second part of a media query is called the media feature and determines when to use the media query. We need to separate this from the @media screen ...

Get Mastering CSS 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.