240 of 313 menu

The clear property

The clear property cancels flowing around one element by another, specified by the float property. It can take the following values: none (cancels the effect of itself), both (cancels float simultaneously on the right and left), left (cancels float on the left), right (cancels float on the right)

Syntax

selector { clear: none or left or right or both }

Example

Let's cancel the text from flowing around the image left side:

<img class="image" src="bg.png" alt=""> <div class="txt"> <p> text text text text text text text text text text text text text text text text text text text text text text text text </p> </div> .image { float: left; padding-right: 10px; } .txt { clear: left; }

:

Example

Now let's cancel flowing around of image by text from right:

<img class="image" src="bg.png" alt=""> <div class="txt"> <p> text text text text text text text text text text text text text text text text text text text text text text text text </p> </div> .image { float: right; padding-right: 10px; } .txt { clear: right; }

:

Example

Let's cancel an effect of the clear property itself:

<img class="image" src="bg.png" alt=""> <div class="txt"> <p> text text text text text text text text text text text text text text text text text text text text text text text text </p> </div> .image { float: right; padding-right: 10px; } .txt { clear: none; }

:

See also

  • the bottom property
    that specifies a position of an element bottom edge
  • the top property
    that specifies a position of an element top edge
  • the left property
    that specifies a position of an element left edge
  • the right property
    that specifies a position of an element right edge
  • the ::backdrop pseudo-element
    that specifies a position after the first element
  • the caption-side property
    that specifies a position of a table header
byenru