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
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.
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.
This example shows a
br with which a
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>
This attribute can take a number of
"right", to clear
previous left or right alignments respectively;
to clear both alignments; and
"none", to clear
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.