clear (HTML attribute)

Spec
Depr. Version
Yes HTML 3.2
Browser support (more…)
IE5.5+ FF1+ SA1.3+ OP9.2+ CH2+
Full Full Full Full Full

Syntax

clear=" { all | left | none | right } "

Description

The clear attribute is a deprecated (presentational) attribute that’s used to clear any preexisting right or left alignments. It ensures that the content after the br element appears beneath the baseline of the previously aligned element; the br doesn’t just create a line break in the content that’s flowing around the right- or left-aligned element.

In the past, this approach would most often have been used to stop content wrapping around a right- or left-aligned image or table.

The correct way of managing alignment issues is to use the CSS float property, rather than the HTML align attribute. To clear elements, we use the CSS clear property like so:

<br clear="left"/> the old-fashioned HTML way

<br style="clear:left;"/> the CSS way

Note that you should avoid inline CSS styles—the inline style above is provided for direct comparison purposes only.

Example

This example shows a br with which a clear attribute is used to take content below a right-aligned image:

<p><img src="pool.jpg" alt="sitting by the pool" align="right"/>
    The rest of the day was a lazy one, partly spent by the complex
    pool, partly inside watching British TV, but we couldn't be doing
    this for the rest of the holiday. Already we were missing having
    the car!
  <br clear="all"/>
    I decided to check out what the weather would be doing for the next
    few days, as that would help us make any decisions about future
    excursions.
</p>

Value

This attribute can take a number of values: "left" or "right", to clear previous left or right alignments respectively; "all", to clear both alignments; and "none", to clear nothing.

Compatibility

Internet Explorer Firefox Safari Opera Chrome
5.5 6.0 7.0 8.0 1.0 1.5 2.0 3.0 3.5 1.3 2.0 3.1 4.0 9.2 9.5 10.0 2.0
Full Full Full Full Full Full Full Full Full Full Full Full Full Full Full Full Full

Although support for this attribute is good, it’s now deprecated, and is highly presentational in its nature. The desired visual effects can all be achieved with CSS and, as such, this attribute shouldn’t be used—it’s presented here for informational purposes only.

User-contributed notes

There are no comments yet.

Related Products