DEV Community

Cover image for Detection device type with pure CSS
Slava Borodulin
Slava Borodulin

Posted on

Detection device type with pure CSS

/* smartphones, touchscreens */
@media (hover: none) and (pointer: coarse) {
    /* ... */
}
/* stylus-based screens */
@media (hover: none) and (pointer: fine) {
    /* ... */
}
/* Nintendo Wii controller, Microsoft Kinect */
@media (hover: hover) and (pointer: coarse) {
    /* ... */
}
/* mouse, touch pad */
@media (hover: hover) and (pointer: fine) {
    /* ... */
}
Enter fullscreen mode Exit fullscreen mode

Top comments (5)

Collapse
 
gabrieljm profile image
Gabriel José

I liked the post, small and to the point!!!

Collapse
 
alexbillerey profile image
Alex Billerey

Brief and to the point. Nice one. Thanks.

Collapse
 
obscuregit profile image
Obscure-Git

Helpful.

Collapse
 
mrdanielschwarz profile image
Daniel Schwarz

What's the browser support like?

Collapse
 
swagwik profile image
Sattwik Sahu

Oh... That's interesting! Thanks for sharing