Jump to content

Block as a link in IE


Alexancho

Recommended Posts

I want a block contained some elements to be a link.For example:

<h1>It is a link:</h1><a href="http://www.google.com/"><span style="display:block; width:150px; height:150px; background:#babadf;"><span style="display:block; width:50px; height:50px; background:#acdefb;"></span></span></a>

It works in FF, but in IE it behaves different. It is actually a link, but cursor doesn't change over this area and you can't use "Open in New Tab" or "Open in New Window" option. How to make this link behave in IE the same way as it behaves in FF?

Link to comment
Share on other sites

just add cursor: pointer; to outer span.<h1>It is a link:</h1><a href="http://www.google.com/"><span'>http://www.google.com/"><span style="display:block; width:150px; height:150px; background:#babadf; cursor:pointer;"><span style="display:block; width:50px; height:50px; background:#acdefb;"></span></span>

and you can't use "Open in New Tab" or "Open in New Window" option. How to make this link behave in IE the same way as it behaves in FF?
in transitional doctype you would use<a href="http://www.google.com/" target="_blank">in strict you would have to use javascript<script type="text/javascript">/*<![CDATA[*//*---->*/function gohere(element){document.getElementById(element.id).target="_blank";}/*--*//*]]>*/</script><a href="http://www.google.com/" id="thislink1" onclick="gohere(this)">
Link to comment
Share on other sites

either do this<h1>It is a link:</h1><a href="http://www.google.com/" style="display:block; width:150px; height:150px;"><span style="display:block; width:150px; height:150px; background:#babadf; cursor:pointer;"><span style="display:block; width:50px; height:50px; background:#acdefb;"></span></span></a>or this <h1>It is a link:</h1><a href="http://www.google.com/" style="display:block; width:150px; height:150px;background:#babadf; "><span style="display:block; width:50px; height:50px; background:#acdefb;"></span></a>

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...