Created
September 21, 2026 11:00
-
-
Save ranbena/702515f1fa01a1da4e4e272eb014b882 to your computer and use it in GitHub Desktop.
Fix for mobile browser "tap on hover"
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @mixin hover-no-touch { | |
| @media (hover: hover) and (pointer: fine) and not (any-pointer: coarse) { | |
| @content; | |
| } | |
| } | |
| // (hover: hover) → main pointer can hover | |
| // and (pointer: fine) → that pointer is a cursor, not a finger | |
| // and not (any-pointer: coarse) → nothing coarse is plugged in / built in | |
| .btn { | |
| background: ...; | |
| // only apply hover for non-touch devices | |
| @include hover-no-touch { | |
| &:hover { | |
| background: ...; | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment