Home

How to Create Paragraphs in HTML5

|
|  Updated:  
2016-03-26 14:03:48
HTML5 and CSS3 All-in-One For Dummies
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>
<html>
  <head>
    <meta charset="UTF-8">
    <title>All About Blocks</title>
  </head>
  <body>
    <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>
  </body>
</html>

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.

image0.jpg

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 author:

Ed Tittel is a 28-year veteran of the computer industry. A seasoned author and consultant, Ed has more than 140 books to his credit.

Chris Minnick is an accomplished author, teacher, and programmer. Minnick authored or co-authored over 20 books, including titles in the For Dummies series. He has developed video courses for top online training platforms and he teaches programming and machine learning to professional developers at some of the largest global companies.