Sign in Registration

CSS float and clear properties - how to float a block and clear the float

When placing elements on a page, it is often necessary to make the flow around one block over another. To do this, CSS styles correctly there is a special property - float . It is usually not clear to a novice developer how this property works, but with practice it gets fixed. It is important to understand that after applying a property, it may also be necessary to clean up the float so that other elements are not floated.


A bit of background. Previously, tables were mostly used to place one element to the left or right of another. But this approach is outdated, layout began to be done using div blocks, and therefore a new property was invented for them - float .

What values ​​does this property have? There are not many of them:

As mentioned above, after applying the float property, you may need to undo its effect - clear the float . This can be done using the clear property, it was created for this purpose.

What values ​​can be specified for clear ? Let's see below:

So we have seen how to wrap an element to the left or right, and how to clear wrap using a custom property.

Comments (0)
For commenting sign in or register.

Latest articles

Popular sections


Login to the web version
Android app:
Available on Google Play

Share this

Subscribe to