How to Create Paragraphs in HTML5 - dummies

How to Create Paragraphs in HTML5

By Ed Tittel, Chris Minnick

Paragraphs appear more often than any other text block in web pages. Remember, though, that HTML browsers don’t recognize hard returns that you enter when you create your page inside an editor. You must use a <p> tag to tell the browser to package all text up to the next closing </p> tag as a paragraph.

To create a paragraph, follow these steps:

  1. Add <p> in the body of the document.

  2. Type the content of the paragraph.

  3. Add </p> to close that paragraph.

Here’s what it looks like:

<!DOCTYPE html>
    <meta charset="UTF-8">
    <title>All About Blocks</title>
    <p>This is a paragraph. It's a very simple structure that you will use
       time and again in your web pages.</p>
    <p>This is another paragraph. What could be simpler to create?</p>

This HTML page includes two paragraphs, each marked with a separate <p> element. Most web browsers add a line break and a full line of white space after every paragraph on your page, as shown in this figure.


Sloppy HTML coders don’t use the closing </p> tag when they create paragraphs. Although some browsers permit this dubious practice without yelling, omitting the closing tag isn’t good practice because it

  • Isn’t correct syntax.

  • Causes problems with style sheets.

  • Can cause a page to appear inconsistently from one browser to another.

You can control paragraph formatting (color, style, size, and alignment) with Cascading Style Sheets (CSS).