CSS clearing external float

Sic

Sic

Soldato
Joined
9 Nov 2004
Posts
15,365
Location
SO16
Is it a CSS rule (sent to annoy me) that if you clear an element inside a container, it will clear any floated elements outside that container?

noooogq2.png


the horrible brown div should clear the green and red ones, so sit snugly under the green one, but it's jumping under the annoying purple one, just because it's floated. is there any way i can clear:inherit,left or something so that it ignores floats outside its container div? failing that there's going to be some ugly inline styling that i'd rather avoid!

thank you :)
 
that didn't work. i want the horrible brown box to stay inside the lilac box. the purpley box is variable height, too :(
 
have you tried setting the clear to right instead of both? or, another idea is to create a empty div set to block and put that below the two boxes before the brown, i think they should give the effect your after, but will leave the height of the div as empty space.

If you could post the code it will help a lot more.
 
Last edited:
ooh, that's not a bad idea actually. i think i'll set a div at 100% of the parent. the divs above it are floated left, so clearing right won't work. and this is CSS you don't want to see. i'm afraid i'd be embarassed - i've taken it over from someone else, and there's no point messing with it. was just wondering if there was a quick fix, and you've given me a nice plaster to put over it til i can clean it up long term!! :D

thanks
 
Back
Top Bottom