Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here



Browser Bugs Affecting CSS

Why is the whole box not clickable in IE6 when using display: block to alter the appearance of links? by harrysdad
Posted: 1 Jul 04 (Edited 11 Jul 04)

You can use display: block to turn a link into a block level element. This is useful if you want to display a series of links as a menu. You can alter an unordered list, for example, so that it appears to be a table containing links, and use the a:hover psuedo class to change the background colour when the mouse pointer hovers over the link. In such a situation you would want the whole box to behave like a link. In most browsers it does, however in IE only the linked word triggers the hover behaviour.

However, you can get around this by setting the width of the link to 100%. Your css might look something like this:-

#styleswitch ul li a {
    color: #000066;
    background-color: #FF9900;
    display: block;
    text-decoration: none;
    font-weight: bold;
    margin: 0px;
    padding: 0px;
    width: 100%;

This doesn't alter the behaviour in other browsers, and it makes it work as desired in IE. There may be situations where a setting of 100% will produce undesireable results, depending on the kind of element in which the links appears. In such cases, set the width to any value you desire in pixels - as long as a width is set it will still work as desired.

Back to HTML, XHTML & CSS FAQ Index
Back to HTML, XHTML & CSS Forum

My Archive

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close