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.
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>
The Principles of Beautiful Web Design, 4th Edition
Learn PHP in One Day and Learn It Well
Docker for Web Developers