English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

CSS Reference Manual

CSS @rules (RULES)

Comprehensive List of CSS Properties

CSS clear attribute usage and examples

The clear CSS attribute specifies which side of the element does not allow other floated elements.Learn more.

The following table provides usage instructions and version history of this attribute, as well as its usage syntax in JavaScript scripts.

Default value:none
Applies to:All elements
Inheritance:None
Animated:No View Animation properties.
Version:CSS 1,2,3
JavaScript syntax:object.style.clear="left"

Syntax of clear usage

The syntax of this attribute is as follows:

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

The following example demonstrates how to use the clear attribute.

  clearfix:after  {
   content: ".";
   display: block;
   height: 0;
   visibility: hidden;
   clear: both;
  }
Test and see‹/›

Attribute value

The following table describes the value of this attribute.

ValueDescription
leftThe element moves down to clear the past left floating.
rightThe element moves down to clear the past right floating.
bothThe element moves down to clear both left and right floating.
autoDo not clear any previously floated elements. This is the default value.
initialSet this attribute to its default value.
inheritIf specified, the associated elements adopt the clear attribute value of their parent element.

Browser compatibility

Browser compatibility of clear attribute, the numbers in the table below indicate the minimum version number of browsers that support this attribute; all mainstream browsers support this attribute.

  • Firefox 1+

  • Google Chrome1+

  • Internet Explorer 5+

  • Apple Safari 1+

  • Opera 6+

Read more

See tutorial:CSS Float.

Related attributes:float.