Setting Up the Document Structure in HTML5

  • 1/26/2001

Creating Paragraphs and Line Breaks

Within the <body> section of the document, you type the text that will appear on the Web page. Each paragraph of text should be enclosed in a two-sided tag that indicates its type.

The most basic paragraph type is the body paragraph, indicated by the <p> tag. It is a two-sided tag, so the paragraph text is placed between a <p> and a </p>.

When a browser displays a Web page, it inserts vertical white space between paragraphs:

That spacing is usually convenient, but it can be a problem when the extra space between lines is unwanted, such as with an address.

To create a line break without officially starting a new paragraph (and thereby adding that extra white space), use the <br> tag. This is a one-sided tag placed within a paragraph, at the end of each line, like this:

<p>David Jaffe<br>
317-555-8882</p>

In this exercise, you will add text to an HTML file template, and then preview it in Microsoft Internet Explorer.

  1. Save the HTML5 file in the Documents\Microsoft Press\HTML5 SBS folder as index.htm.

  2. Open the index file in Internet Explorer and arrange the Notepad and Internet Explorer windows so that both are visible.

    The index file displayed in Internet Explorer is currently blank.

  3. In the Notepad window, type the following between the <body> and </body> tags:

    <p>Welcome to The Garden Company! We hope you will find our site a useful
    resource for becoming a better gardener.<p>
    <p>Our main store is located at:<br>
    108 Ponting Street<br>
    Macon, IN 46062</p>
    <p>Please stop by and browse our extensive inventory from Monday through
    Saturday, 7:00 a.m. to 8:00 p.m.</p>
  4. Save your work, and then press F5 or click the Refresh button at the right side of the Address bar to refresh the display in Internet Explorer to see the result of the changes. Leave both windows open for the next exercise.