2 replies [Last post]
armyofda12mnkeys
Offline
Enthusiast
Last seen: 14 years 24 weeks ago
Timezone: GMT-3
Joined: 2005-12-01
Posts: 117
Points: 0

1. it seems like putting a clearing float in the inside of the div works best even though should probably do it with next elemen i think. is this true or it shouldnt matter. (or certain browsers might have bugs if you dont clear it inside the containing div)

<div>
<div class="floatLeft">xxx</div>
<div class="floatRight">xxx</div>
content content content content content
</div>
<div class="clearPrevious">content</div>

OR

<div>
<div class="floatLeft">xxx</div>
<div class="floatRight">xxx</div>
content content content content content
<div class="clearPrevious"/>
</div>
<div>content</div>

2. If you want to float many items. Where should those items preferably go in the container div. all floats at the top/doesnt matter, at bottom(wondering if there is some browsers that fudge if you dont do it a certain way). Example...
<div>
<div class="floatLeft">xxx</div>
<div class="floatLeft">xxx</div>
content content content content content
content content content content content
content content content content content
<div class="floatRight">xxx</div>
<div class="floatRight">xxx</div>
</div>

When all
\/-rated Sites convert 'intensive' sites to CSS,
/\
bandwidth on the internet will be cut down by 42%. )

Tyssen
Tyssen's picture
Offline
Moderator
Brisbane
Last seen: 6 years 21 weeks ago
Brisbane
Timezone: GMT+10
Joined: 2004-05-01
Posts: 8201
Points: 1386

[Solved] float questions

1. Using clearing elements is acceptable practice because in some cases float clearing applied to the float container doesn't always work in all browsers.
2. All the floats have to come first in the source ahead of non-floated content.

How to get help
Post a link. If you can't post a link, jsFiddle it.
My blog | My older articles | CSS Reference

armyofda12mnkeys
Offline
Enthusiast
Last seen: 14 years 24 weeks ago
Timezone: GMT-3
Joined: 2005-12-01
Posts: 117
Points: 0

[Solved] float questions

thanks for clearcut answers! Smile

When all
\/-rated Sites convert 'intensive' sites to CSS,
/\
bandwidth on the internet will be cut down by 42%. )