From the course: Advanced CSS Media Queries
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Testing for conditions with not - CSS Tutorial
From the course: Advanced CSS Media Queries
Testing for conditions with not
- [Instructor] Not is useful for testing when a condition is not met. It applies to the portion of the media query it immediately proceeds. It does not apply to all of the tests in a complex media query. Interestingly, not must also be used with a media type like all, screen, print, or speech as part of its test. So, here's the same example we've been using all through this course, let's write a really quick media query using not that's really easy to understand. So if I said at media not print. All right, so if it's not print, do the stuff. And I'm just going to copy in these last four styles that I've already written here. They control the colors of those icons there on that page. And I'm going to drop them here inside of the media query. So basically I'm saying, if I'm not printing, show this color. Pretty straightforward. If I go ahead and save that, and then take a look at this in full page view, and then click…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.