HTML and CSS Reference
In-Depth Information
Dave thinks the comments are diffi cult to read when the text of a comment runs into
the citation. He suggests that you start each citation on a new line. To do this, you can
insert a line break into the Web page using the following empty element tag:
<br />
Line breaks must be placed within grouping elements such as paragraphs or head-
ings. Some browsers accept line breaks placed anywhere within the body of a Web page;
however, this is not good coding technique. A browser displaying an XHTML document
will reject code in which a text-level element such as
br
is placed outside of any group-
ing element.
You'll use the
br
element to mark a line break between each customer comment and
its associated citation in Dave's Web page.
To insert line breaks in the comments:
◗
1.
Return to the
jprop.htm
file in your text editor.
◗
2.
Insert the tag
<br />
between the comment and the citation for each of the three
customer comments in the file. See Figure 1-41.
Figure 1-41
Inserting line breaks
line break element
◗
3.
Save your changes to the file and then refresh the
jprop.htm
file in your Web
browser. Verify that each citation starts on a new line below the associated cus-
tomer comment.
Marking a Horizontal Rule
Another empty element is
hr
, the horizontal rule element, which marks a major topic
change within a section. The syntax of the
hr
element is as follows:
<hr />
The exact appearance of the
hr
element is left to the browser. Most browsers display
a gray-shaded horizontal line a few pixels in height. The
hr
element was originally used
as a quick way of inserting horizontal lines within a Web page. Although that task now
should be left to style sheets, you will still see the
hr
element in older Web pages.