Jesse Rusak Jesse Rusak - 1 year ago 66
CSS Question

:active pseudo-class doesn't work in mobile safari

In Webkit on iPhone/iPad/iPod, specifying styling for an :active pseudo-class for an

tag doesn't trigger when you tap on the element. How can I get this to trigger? Example code:

a:active {
background-color: red;
<!-- snip -->
<a href="#">Click me</a>

Answer Source
<body ontouchstart="">

Applied just once, as opposed to every button element seemed to fix all buttons on the page. Alternatively you could use this small JS library called 'Fastclick'. It speed up click events on touch devices and takes care of this issue too.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download