Paragraphs


Now that you have a page title and several headings, you can add some ordinary paragraphs to the page.

The first version of HTML specified the <p> tag as a one-sided tag. There was no corresponding </p>, and the <p> tag was used to indicate the end of a paragraph (a paragraph break), not the beginning. So, paragraphs in the first version of HTML looked like the following:

Slowly and deliberately, Enigern approached the mighty dragon. A rustle in the trees of the nearby forest distracted his attention for a brief moment, a near fatal mistake for the brave knight.<p> The dragon lunged at him, searing Enigern's armor with a rapid blast of fiery breath. Enigern fell to the ground as the dragon hovered over him. He quickly drew his sword and thrust it into the dragon's chest.<p>


Most early browsers assumed that paragraphs would be formatted this way. When they came across a <p> tag, these older browsers started a new line and added some extra white space between the line that just ended and the next one.

As of the HTML 4.01 standard, paragraph tags are two-sided (<p>...</p>), and <p> indicates the beginning of the paragraph. The closing tag is no longer optional, so rather than using <p> to indicate where one paragraph ends and another begins, you enclose each paragraph within a <p> tag. So, the Enigern story should look like this:

<p>Slowly and deliberately, Enigern approached the mighty dragon. A rustle in the trees of the nearby forest distracted his attention for a brief moment, a near fatal mistake for the brave knight.</p> <p>The dragon lunged at him, searing Enigern's armor with a rapid blast of fiery breath. Enigern fell to the ground as the dragon hovered over him. He quickly drew his sword and thrust it into the dragon's chest.</p>


At this point, you should be wrapping your paragraphs inside opening and closing <p> tags. Older browsers accept this usage just fine, and it's up to speed with the current standards. Although at one time it was optional to use the closing </p> tag, it's required under the XHTML 1.0 recommendation because all tags must be closed.

Some people prefer to use extra <p> tags between paragraphs to spread out the text on the page. Again, here's the cardinal reminder: Design for content, not for appearance. This is also an area where browsers are inconsistent. Some of them won't add space for empty <p> tags at all. Besides, these days controlling white space is best done with CSS. Figure 4.3 shows what happens when I add another paragraph about Enigern and the dragon to the page. The paragraph breaks are added between the closing and opening <p> tags in the text.

Input

<p>The dragon fell to the ground, releasing an anguished cry and seething in pain. The thrust of Enigern's sword proved fatal as the dragon breathed its last breath. Now Enigern was free to release Lady Aelfleada from her imprisonment in the dragon's lair. </p>


Output

Figure 4.3. An HTML paragraph.





Sams Teach Yourself Web Publishing with HTML and CSS in One Hour a Day
Sams Teach Yourself Web Publishing with HTML and CSS in One Hour a Day (5th Edition)
ISBN: 0672328860
EAN: 2147483647
Year: 2007
Pages: 305

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net