Accessibility

CSS Advisor

Internet Explorer does not make the whole link clickable

by Thierry Koblentz on December 18, 2006 Avg Rating 2.8 (5)   |   Log in to rate post.

Tagged with Display , Explorer 6.0 , Explorer 5.0 , clickable area , Explorer 5.5 , hand cursor , Explorer for Mac , hover

Problem

Even when anchors are styled with "display:block", the cursor does not become a hand when hovering over the area surrounding the text links.

Solution

Use the Holly Hack to support Internet Explorer v. 5 and 6 or the "white space" fix if support for IE 5.0 is not required.

Detailed description

Anchors styled with "display:block" should offer a clickable area larger than the text link itself (the whole box should be "hot"). Example:


a {
display:block; text-decoration:none; padding:.5em; }


Unfortunately, in Internet Explorer, unless "hasLayout" is turned on, the cursor shape would revert to "default" as soon as it moves out of the text link area.

You can "give layout" to the A elements using a variation of the Holly Hack (inside a Conditional Comment). For example:

<!--[if lt IE 7]>
<style type="text/css" media="screen">
a {height:0;}
</style>
<![endif]-->

The above solution works with versions 5.0, 5.5 and 6.

If support for IE 5.0 is not required, then you can use the "white-space-fix", placing the following rule above the other.
a {display:inline-block}

Test case

Read about what I call the "white-space-fix"".







Text ID: INTERNET_EXPLORER_DOES_NOT_MAKE_THE_WHOLE_LINK_CLICKABLE_



Comments (5)

To add a comment, please Log in.




Width is not that safe...

Using "width" works fine, but forces CSS authors to take into consideration padding/border values. Also, let's not forget that the box is built *differently* depending on "mode"  (Quirks vs. Standard)...

Width is not that safe...

Using "width" works fine, but forces CSS authors to take into consideration padding/border values. Also, let's not forget that the box is built *differently* depending on "mode"  (Quirks vs. Standard)...

Width is not that safe...

Using "width" works fine, but forces CSS authors to take into consideration padding/border values. Also, let's not forget that the box is built *differently* depending on "mode"  (Quirks vs. Standard)...

or define a width...

As amy_ok said.. width 100% wrks as does defining whatever width your column is. I would say avoid the hack if you can.

width: 100%

I usually use width:100%; o make the entire area clickable in IE





CSS Advisor home
Submit a post

rss

CSS ADVISOR RSS FEEDS
Recent: POSTS | COMMENTS | EDITS


Browsers
Internet Explorer (45)
Mozilla/Firefox (16)
Opera (7)
Safari (13)
CSS Properties
Background (6)
Border (3)
Color (1)
Float (15)
Font (1)
Margin (6)
Padding (4)
Position (15)
Text (13)
Width/Height (9)