2 replies [Last post]
Pilot-Doofy
Pilot-Doofy's picture
Offline
newbie
Clemmons, North Carolina
Last seen: 13 years 18 weeks ago
Clemmons, North Carolina
Timezone: GMT-4
Joined: 2006-05-29
Posts: 8
Points: 0

I have a few test items I'm performing experiments on. I can't seem to figure out how to escape the float: left; fad, if you will. Here is my code:

<div style="float: left;">
Hello
</div>

<div style="float: left;">
Hello
</div>

<div style="float: none;">
Hello
</div>

But it displays: HelloHelloHello

Shouldn't it be

HelloHello
Hello

?

How do you escape float once you have established it?

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

[Solved] Question about float: left;

You don't need float: none because no float has been applied to it (float: none is the default so you'd only need to use the rule explicitly if the element was inheriting float behaviour from another rule). Use clear: left/both to turn the last div to a new line.

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

Pilot-Doofy
Pilot-Doofy's picture
Offline
newbie
Clemmons, North Carolina
Last seen: 13 years 18 weeks ago
Clemmons, North Carolina
Timezone: GMT-4
Joined: 2006-05-29
Posts: 8
Points: 0

[Solved] Question about float: left;

Thanks man, perfect solution!!