JavaScript EditorBest javascript editor debugger     Ajax website 



Main Page

Previous Page
Next Page

Starting a New Paragraph

(X)HTML does not recognize the returns or other extra white space that you enter in your text editor (see page 32). To start a new paragraph in your Web page, you use the p tag.

Figure 3.12. Enclose each paragraph in opening and closing p tags. If you don't close them (which is perfectly legal in HTML but not XHTML), styles won't be applied properly.


To begin a new paragraph:

1.
Type <p>.

2.
Type the contents of the new paragraph.

3.
Type </p> to end the paragraph.

Figure 3.13. The amount of space between each paragraph is proportional to the size of the text.


Tips

  • The closing </p> tag is required both in XHTML and when applying styles to a paragraph. Therefore, I recommend always ending a paragraph with </p>. In HTML, the closing </p> tag is optional.

  • You can use styles to format paragraphs with a particular font, size, or color (and more). For details, consult Chapter 10, Formatting with Styles.

  • To control the amount of space between lines, consult Setting the Line Height on page 158. To control the amount of space after a paragraph, consult Setting the Margins around an Element on page 176 or Adding Padding around an Element on page 177.

  • One quick and dirty (and valid) trick for adding extra space between paragraphs is to type &nbsp; (a non-breaking space) between each additional p element. Still, it's better to use CSS (see pages 176177).

  • You can align the text in the paragraph by typing align="direction" in the opening p tag, where direction is left, right, center, or justify. But note that the align attribute has been deprecated in favor of style sheets (see page 165).



Previous Page
Next Page


JavaScript EditorBest javascript editor debugger     Ajax website 
R7