Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS Empty divs just feel wrong… Re: Empty divs just feel wrong…

#50032
cssgirl
Participant
"mikes" wrote:
I’m pretty new to css layout so maybe I’m doing this all wrong. When I need to float something I seem to need to do a clear:both afterwards to keep from screwing up whatever follows. I’ve been doing it like this:

Code:
Put something here.
Put something next to it.
Put something on the right.”

That really feels like a hack. Is there a better way?

You don’t have a width to your floats. Therefore it will float left and set a width to the size of your content within it. The divs with floats positioned after then will float to the left and not clear because of the lack of a width.