CSS clear: Ways to use clear with both and left values example

The Clear property

The CSS clear property is used to specify floating of the other element. By default, you can float an element in either direction, left or right of the other element. However, by using the clear CSS property you can specify which direction to allow and to not allow other element’s floating.

An example of clear property

Clear property has the following values:

  1. Clear: none (This is the default value where other elements are allowed to float in any direction).
  2. Clear: left (The other element is not allowed to float left).
  3. Clear: right (The other element is not allowed to float right).
  4. Clear: both (The other element is not allowed to float left or right)

Clear property with both and left values example

The following example shows how to use CSS clear property. The example below shows four paragraphs.

The first two paragraphs use CSS clear: both value while images are set with float property to the left and right, respectively.

The last two paragraphs use the default value in the clear property. You can see the difference by seeing the example online.

Experience this example online


 

Also see CSS float

Was this article helpful?

Related Articles

Leave A Comment?