Skip to content

Instantly share code, notes, and snippets.

@hfknight
Last active February 9, 2016 19:37
Show Gist options
  • Save hfknight/78cc2c1b354af0c75692 to your computer and use it in GitHub Desktop.
Save hfknight/78cc2c1b354af0c75692 to your computer and use it in GitHub Desktop.
Mobile Safari CSS :hover caching issue (go back button)
/* on an iOS device, when you click the link having :hover css and navigate away to the next page and then hit the browsers’ back button, when you come back on this screen, you will see the above link is still in hover state */
// use Modernizr, the no-touch class will be added to the root html element for non-touch devices. Then you can do this
a.myclass {
color:#999;
}
.no-touch a.myclass:hover,
a.myclass:active {
color:#ccc;
}
// or use media query to limit the hover state only on desktop (no sense to use hover on mobile web anyway)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment