<a> with an inner <span> not triggering :active state in IE 8
Posted
by Adam Singer
on Stack Overflow
See other posts from Stack Overflow
or by Adam Singer
Published on 2010-05-04T22:32:31Z
Indexed on
2010/05/04
23:38 UTC
Read the original article
Hit count: 166
I want to style the :active
state of a button that is represented by an <a>
tag. The <a>
tag has an inner <span>
(beacuse I want to add an icon to this button).
I notice the :active
state is triggered properly in everything but Internet Explorer 8. In IE 8, it appears that the area around the <span>
(the <a>
’s padding) triggers the :active
state, but when clicking directly on the text within the <span>
, the :active
state is not triggered.
Is there a way to fix this without resorting to Javascript?
HTML
<a class="button" href="#">
<span>Add a link</span>
</a>
CSS
a.button { some styles }
a.button:active { some other styles }
© Stack Overflow or respective owner