I've got a bit of a problem creating a navigation element - its working fine in firefox, but seems to be causing me a headache in IE8/IE9. The other odd thing is that it works fine in IE on when running under localhost, but not when run on a server.
I've tried to narrow down the actual issue, and开发者_如何学运维 its seems to be caused by me wrapping a couple of elements (an img and some text), in a span that has display:block. When I do this the image no longer responds to the href javascript of the anchor tag. Its kind of difficult to explain so I've included a cut down example:
<a title="My Link" href='javascript:alert(1);' style="display: block; height: 37px; text-decoration: none;">
<span style="display: block; height: 34px;">
<img title="My Icon" src="mypic.png" alt="ss" />
<span>Link Text</span>
</span>
</a>
Any help would be great!
Matt
The other odd thing is that it works fine in IE on when running under localhost, but not when run on a server.
In that case, the problem is to do with the rendering mode that IE is using. Hit F12 to bring up the Developer Tools to see which mode is being used.
Adding this to your <head>
should sort the problem out:
<meta http-equiv="X-UA-Compatible" content="IE=edge">
精彩评论