Skip to content

Instantly share code, notes, and snippets.

@taimursaeed
Last active March 13, 2020 07:47
Show Gist options
  • Save taimursaeed/277cf0410e24c1062f89dafec7108a53 to your computer and use it in GitHub Desktop.
Save taimursaeed/277cf0410e24c1062f89dafec7108a53 to your computer and use it in GitHub Desktop.
Target Touch Screens Via CSS Queries
@media (pointer: none), (pointer: coarse) {
}
//via https://stackoverflow.com/a/50302305/4882234
/* 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) {
/* ... */
}
// Via: https://medium.com/@ferie/detect-a-touch-device-with-only-css-9f8e30fa1134
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment