scriptygoddess

16 May, 2007

IE 7 not clearing floats

Posted by: Jennifer In: Bookmarks

Hit an interesting CSS thing today. A simple "float: left." A simple clear: both." Firefox understands it. Even IE 6 understands it. But what the heck is IE 7 doing??? See below.

Here is my example page.

Here is how Firefox and IE 6 render that page:
normal rendering

Here is how IE 7 renders it:
IE 7 sucks

What's with the blue box moving around?? I was trying to avoid adding a lot of extra markup, so I made an additional class to clear the third div – thinking the next one would "top align" the following div to that one – like firefox and IE 6 do. But in IE 7, that last div is still floating left to the first few DIVs as if I never cleared that third DIV. The only way to *really* clear it is to add the extra markup of <br clear="all" />

See this example with the extra markup (you'll only notice the difference between this page and the previous one if you're running IE 7)

Anyone have any thoughts as to WHY? or how the extra markup can be avoided? I mean I know a simple <br /> tag isn't the end of the world – but I know adding those just for "layout" issues is "bad"™

(One request I'll make: when responding – if you're going to suggest a solution, please make sure that you've actually downloaded the sample and tested it there before making your suggestion. In the past I've had people suggesting things before they even tried it themselves to see if it'd work. Heh.) :)

2 Responses to "IE 7 not clearing floats"

1 | Stimie

August 6th, 2007 at 7:39 pm

Avatar

I've been told if you go into your CSS style sheet and add the line "display: inline;" that you will will get some magical fix. It doesn't work in IE7 I've noticed, still looking for the answer.

2 | stuck with IE

August 7th, 2007 at 2:16 pm

Avatar

Actually, my IE6 on Win2000 displays it just like your IE7 snapshot…

There are differences between IE6 on Win2000 and IE6 on WinXP, I've noticed. Perhaps this is one of them?

Featured Sponsors

Genesis Framework for WordPress

Advertise Here


  • Scott: Just moved changed the site URL as WP's installed in a subfolder. Cookie clearance worked for me. Thanks!
  • Stephen Lareau: Hi great blog thanks. Just thought I would add that it helps to put target = like this:1-800-555-1212 and
  • Cord Blomquist: Jennifer, you may want to check out tp2wp.com, a new service my company just launched that converts TypePad and Movable Type export files into WordPre

About


Advertisements