What are floats?
This box is floated right.
A float is simply a box (for example, a div
) that is shifted to the left side or the right side of its container. We then say that the box is floated left or floated right.
One of the key benefits of floats is that they allow you to have bits of content sitting side by side, rather than one below the other (much like you can do with table columns, but better!). This allows you to do cool stuff like text columns, boxouts (like the one above), and advanced positioning of your page elements.
Floats are a bit like the align="left"
and align="right"
attributes in img
elements.