I have a clearfix which clears in FF but not IE6 on a validating page. I have had it the other way round but IE6 behaving itself is a little unusual.
Any suggestions?
This is the clearfix code I've used personally for the last few years. I've found that other solutions don't always work for me (including the one-liners that revolve around 'overflow'):
I got to the bottom of it eventually and as usual I was missing the obvious, I had the clearfix set up in the wrong container so it was having no effect - duh!
Foamcow
I tried your suggestion and it worked, is that all that needs to be done, float the parent container? If so, it seems a much cleaner solution.
Yep. If you float the container it will extend to wrap around floated content.
There are times when it's not ideal though.
When you float an element you will also collapse it's width to that of its contents. If you want your container wider then you need to specify a width. Harmless enough but when you start applying widths to things it can all start to come apart.
The clearing element (the <hr>) is often a simpler option.
-- Tek-Tips Forums is Member Supported. Click Here to donate
<honk>*:O)</honk>
Tyres: Mine's a pint of the black stuff.
Mike: You can't drink a pint of Bovril.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.