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.
Targeting specific devices using complex media queries - CSS Tutorial
From the course: Advanced CSS Media Queries
Targeting specific devices using complex media queries
- [Narrator] One of the really interesting things about these new kinds of media queries is the ability to detect specific devices. And Riccardo Andreatta, hopefully I've said his name correctly, wrote this great article on Medium about detecting a touch device using only CSS. In his article, he is going to explain exactly how the hover feature works, the pointer feature. These are things I've already explained to you. Then about halfway through the article, he will show you how you can combine various kinds of hover and pointer media queries to detect certain devices. So for example, to start here for smartphones and touch screens, we can set the hover state to none and the pointer to coarse. So, in other words, a phone, of course, has no hover state. And since you're going to use your finger as a pointer, the combination of those two media queries should indicate that you're working with a phone or probably a tablet. If…
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.
Contents
-
-
-
-
(Locked)
Testing for conditions with and3m 11s
-
(Locked)
Testing for conditions with not4m 15s
-
(Locked)
Testing for comma-separated conditions (or)3m 25s
-
(Locked)
Targeting specific devices using complex media queries3m 39s
-
(Locked)
Working with only42s
-
(Locked)
Challenge1m 23s
-
(Locked)
Solution4m 49s
-
(Locked)
-