theslip — 2010-01-24T04:11:03-05:00 — #1
[B]Hi there, I've been working with float layouts for a while now but have a question you smarter people will be able to help with.;)
Now I always float my divs, containers, but almost never my p,h1,h2 and so on within the div containers, is this correct or should I be floating everything?[/B]
The reason I ask is sometimes I have maybe a table in a floated container div and it pops to the right in safari, I use a float to align it back in but paragraphs underneath it go strange.
Should I be floating everything inclusing p,h1, h2 or am I fine to do either? Big thanks in advance you clever people ya!
ryanreese — 2010-01-24T11:38:02-05:00 — #2
No you should not be floating everything. It sounds like the "paragraphs underneath it" just need a clear on it. Aka clear:both
theslip — 2010-01-25T06:11:46-05:00 — #3
ah cool, I must admit I've only cleared on floats can you use clear on non floated objects? cheers Ryan
paulob — 2010-01-26T07:14:02-05:00 — #4
can you use clear on non floated objects?
Yes you can use clear on all block level elements and in most cases you would probably be using it more than you do on floated elements for the reason that you want following content to clear the floated content above.
ryanreese — 2010-01-26T09:51:57-05:00 — #5
Also if you need shrink wrap behavior then you will also be using a clear on it, because a float/clear create a new line for every float