Spring.Into.HTML.and.CSS [Electronic resources]

Barry J. Rosenberg

نسخه متنی -صفحه : 171/ 27
نمايش فراداده

Adding Paragraphs

Paragraphs are managed using the paragraph element, represented by an opening and closing tag <p>. . .</p>, with text content in between (see Example 2-2).

Example 2-2. Marking up paragraphs with an opening and closing tag
[View full width]

<p>Mentally, too, they were almost moribund. They stared vacantly, straight out to sea.
 They stared with the unwinking fixedness of those whose gaze is caught in hypnotic trance.</p>
<p>It was Frank Merrill who broke the silence finally. Merrill still looked like a man of
 marble and his voice still kept its unnatural tone, level, monotonous, metallic.</p>

Figure 2-2 shows how the paragraphs will appear within a web browser. You'll note that all the necessary carriage returns are handled when the browser interprets the paragraph tags.

Figure 2-2. Paragraph formatting in the web browser.

NOTE

You will see instances when there's no closing tag in paragraphs. This is legal in HTML, but even when using HTML instead of XHTML, it's good practice to close your paragraph tags. The display is the same no matter which approach you use.

Text lines in paragraphs will break only in accordance with the size of the browser window and will flow to fill any available space until the end of the paragraph. At that point, there is a full break plus a line before the ensuing content.