Html Structure
<a>
<span> <!-- Span has width & height -->
<img>
</span>
<span> Some text <span>
</a>
Anchor is not clickable only in IE7, I know the issue happens because of hasLayout, if we remove height & width of the span, it will work fine.
But I need to make it work with out removing height & width.
EDIT: You can fiddle with an example here: http://jsfiddle.net/rxcAb
CSS Only Solution
Tomas-I modified your fiddle into a working example. I changed your code to use a
spaninside theatag because it is invalid to have a standard block level element (adiv) in an inline element (anatag). Giving theatag layout (I usedinline-block) and then setting aposition:relativeon thatspanwith az-index: -1pushes thespan“below” theatag and makes IE7 recognize theatag as active again. Below is the modified code used in my fiddle. You might want to set up a more generic class name than myie7AFix(you probably will also want to just target IE7 for those CSS properties that are necessary for it only). I assume you are varying thewidthandheightby images, and hence why you have those as inline styling.HTML
CSS
Updated Fiddle with
line-heightadded to make “cross browser” if one does not want to target IE7 only. I kept thewidthandheightin thespanhtml above, only because the original question (by both gviswanathan and Tomas) requested it. If you don’t need to set the dimensions on thespanfor some reason, but are simply trying to do a double border on the image, then thirtydot’s answer given in the comment’s below is much simpler.