Click to See Complete Forum and Search --> : Float affecting parent div - why?


emayoh
10-12-2006, 12:12 AM
I want to achieve this:


Copy copy copy copy

-----------------
| BOX 1 | BOX 2 |
-----------------

Copy continues below boxes


I am trying this

<DIV style="float:none;">
<DIV style="float:left; clear:right;">Box 1</DIV>
<DIV style="float:left; clear:right;">Box 2</DIV>
</DIV>

and I get this result:



Copy copy copy copy

----------------- Copy is continuing here
| BOX 1 | BOX 2 |
-----------------


Why doesn't float:NONE wrapped around the whole thing keep the whole thing from floating left?

_Aerospace_Eng_
10-12-2006, 12:16 AM
Why would it? Its not being floated in the first place. Its the divs within it that are being floated. You floated both boxes. Just float one of them but doing so will not allow the text to go up next to the first box.

felgall
10-12-2006, 03:08 AM
You need clear:left on the element that you want under the boxes in order to stop it going to the right of left floated elements.