Beginning HTML5 and CSS3 For Dummies
Book image
Explore Book Buy On Amazon

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

tag to tell the browser to package all text up to the next closing

tag as a paragraph.

To create a paragraph, follow these steps:

  1. Add

    in the body of the document.

  2. Type the content of the paragraph.

  3. Add

    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

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

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).

About This Article

This article is from the book:

About the book authors:

Ed Tittel is a 30-year veteran of the technology industry with more than 140 computing books to his credit, including the bestselling HTML For Dummies.

Chris Minnick runs Minnick Web Services. He teaches, speaks, and consults on web-related topics and has contributed to numerous books, including WebKit For Dummies.

This article can be found in the category: