CSS Floats

Using the float Property

The float property allows an element to be taken out of the normal document flow and be positioned to the left or right of its container. Common values for float include leftright, and none (default).

In this example, .image-left will float to the left, and .image-right will float to the right. The margin is added to create spacing between the floated element and surrounding content.

Tutorials dojo strip
CSS




Clearing Floats

When elements are floated, the following content can wrap around them. The clear property is used to prevent this, ensuring that the next element moves below the floated elements.

CSS




CSS Floats Example Code

CSS




CSS Labs

Tutorials dojo strip