I organized a navigation in proper semantic XHTML: a series of < li> tags and fixed height for each element, with a button type image nested within the li tags. With the fixed CSS height assigned to the li elements, this works properly in IE7, Firefox, and Safari. IE6, however, only displays properly if you don't properly indent your XHTML, as follows:

HTML:
  1. /* Proper code: */
  2.      <li>One</li>
  3.      <li>Two</li>
  4.      <li>Three</li>
  5. </ul>
  6.  
  7. /* What works in IE6 for appearance: */
  8. <ul><li>One</li><li>Two</li><li>Three</li></ul>

Obviously, the latter is not an acceptable solution. One needs properly indented code. For some reason, IE6 reads the whitespace there, unlike the proper interpretation of xml schemas.

To eliminate this, as long as you have an assigned height to your li elements, apply overflow:hidden to the li elements, as follows:

CSS:
  1. li{
  2.    height:20px;
  3.    overflow:hidden;
  4. }

Perfecto! The extra white-space in IE6 is hidden. You can force only IE6 to read this by using the valid CSS * html selector. Thus, only IE6 will apply the filter while retaining valid CSS.

CSS:
  1. li{
  2.    height:20px;
  3. }
  4.  
  5. * html li{
  6.    overflow:hidden;
  7. }

UPDATE:

I just found that this method only works with block-level elements. Recall that the problem only occurs in IE6. Thus, if you are using IE6 and you have an img that you are trying to use overflow:hidden, you must add the following style to the img:

CSS:
  1. * html img{
  2.      display:block;
  3. }

Popularity: 28% [?]

Share and Enjoy:
  • del.icio.us
  • Digg
  • Reddit
  • TwitThis
  • Google Bookmarks
  • StumbleUpon
  • Facebook
  • E-mail this story to a friend!
  • Print this article!