2

I'm trying to style a hyperlink's state when it's tapped on a mobile device. Basically it has to flicker a green color right after being tapped. I've tried all the CSS pseudoclasses for hyperlink states, including:

a:active

a:hover

a:focus

But on my iPhone, the hyperlink doesn't show the intended style when tapped. Is there a better way through CSS or jQuery to accomplish this?

  • Do you mean while it's being tapped or after it has been tapped? Have you tried [`:visited`](https://developer.mozilla.org/en-US/docs/Web/CSS/:visited)? – showdev Jun 08 '16 at 22:00
  • You can check the details from [this question](http://stackoverflow.com/questions/6063308/touch-css-pseudo-class-or-something-similar) – Jimmy Ko Jun 08 '16 at 22:01

1 Answers1

1

You might need to use a hack along with :active

Try adding this event handler to the <body> tag:

<body ontouchstart="">

Reference

cssyphus
  • 37,875
  • 18
  • 96
  • 111