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.

New on Educative
Learn to Code
Learn any Language as a beginner
Develop a human edge in an AI powered world and learn to code with AI from our beginner friendly catalog
🏆 Leaderboard
Daily Coding Challenge
Solve a new coding challenge every day and climb the leaderboard

Free Resources