HTML and CSS Reference
In-Depth Information
Closing Single Tags Properly
Like the
<hr>
tag, the
<br>
tag has no closing tag in HTML. To convert this tag to
XHTML and to ensure compatibility with HTML browsers, add a space and forward
slash to the end of the tag and its attributes, as shown in the following example:
And then is heard no more: it is a tale
<br />
Told by an idiot, full of sound and fury,
<br />
Signifying nothing.
</p>
The following example shows a simple paragraph in which each line (except for the last,
which ends with a closing
<p>
tag) ends with a
<br>
:
Input
▼
<p>
Tomorrow, and tomorrow, and tomorrow,
<br />
Creeps in this petty pace from day to day,
<br />
To the last syllable of recorded time;
<br />
And all our yesterdays have lighted fools
<br />
The way to dusty death. Out, out, brief candle!
<br />
Life's but a walking shadow; a poor player,
<br />
That struts and frets his hour upon the stage,
<br />
And then is heard no more: it is a tale
<br />
Told by an idiot, full of sound and fury,
<br />
Signifying nothing.
</p>
Figure 7.10 shows how it appears in a browser.
NOTE
clear
is an attribute of the
<br>
tag. It's used with images that
have text wrapped alongside them. You'll learn about this attribute
in Lesson 9, “Adding Images, Color, and Backgrounds.”
.
Output
FIGURE 7.10
Line breaks.


