IE6 Bug – white space between 2 divs

Graphic designers just love creating pages that we know will cause IE6 issues. I honestly don’t think they can help it :-)

As I come across my usual bugs I’m going to start posting what the bugs were and how I solved them.

Curving a box – Gap between two divs

Ok, so today I had one of my more common ones. I needed a fixed width curved box for the main content. You can see the page here:
http://www.simonday.com/testing/lush/

I needed a div to hold the top 5px high image for the top curve and then I needed a normal div for the content followed by the same curved image for the bottom.

Now in most browsers the following code will work perfectly:


#whitetop {background-image:url(top.gif); width:949px; height:5px; background-repeat:no-repeat;}
#whitemid {background-color:white;width:949px;}
#whitebot {background-image:url(bot.gif); width:949px;height:5px;background-repeat:no-repeat;}

But if you try this in IE6 you get a nice big gap between the top curved image and your main content as shown below:

overflow

IE6 is messing up the rendering of the whitespace so the solution is to add overflow:hidden to the top div (in this case #whitetop and this forces IE6 to align up the two divs correctly.


Network with Simon on LinkedIn ~ Twitter ~ Facebook ~ freelancer homepage.

Share this post with others:
  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • De.lirio.us
  • Live
  • StumbleUpon
  • LinkedIn
  • Print
  • Slashdot
  • Technorati
  • TwitThis
This entry was posted in Browser Bugs and tagged . Bookmark the permalink.

7 Responses to IE6 Bug – white space between 2 divs

  1. Matt says:

    Cheers Simon – you saved my ass with this one

  2. Kelly Brown says:

    The article is ver good. Write please more

  3. MIchael says:

    I believe another option that would work is to add this to the div instead:
    font-size: 0;

  4. Ahmet says:

    Thanks Simon! you saved my ass too :)

  5. Matt Engelke says:

    Thanks for taking the time to post this ie6 bug – always had to think of a solution when I did rounded corners.

  6. Eva says:

    Thanks, had been searching for a while – just what I needed.
    IE6 my love – when are you disappearing, please?

  7. Landon says:

    Thanks a bunch. Having the exact same issue and have spent the last 2 hours trying everything I can think of to solve this!

    Thanks again!

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Spam protection by WP Captcha-Free