What is the CSS clear property?

The clear property in CSSCascade Style Sheets controls the flow when using the float property. It specifies what will happen to the elements next to the floating elements.

Syntax


clear: none|left|right|both|initial|inherit;

Property values

  • none: This is the default value.

  • left: It is used to push the elements below the left floated elements.

  • right: It pushes the elements below the right floated elements.

  • both: It to pushes the elements below the right and left floated elements.

  • initial: This sets the value to its default value.

  • inherit: This is used to inherit property from its parent value.

Code

The following is the basic HTMLHyperText Markup Language and CSS code to demonstrate the use of the clear property.

Free Resources