How to define a paragraph in HTML5 ?

In this article, we define a paragraph by using a <p> element in the document. The <p> tag in HTML defines the paragraph. These have both opening and closing tags. So anything written within <p> and </p> is treated as a paragraph content. Most browsers read a line as a paragraph even if we don’t use the closing tag i.e. </p> but this may raise unexpected results. So, it is both a good convention and we must use the closing tag.

Syntax:

<p> Content... </p>

Example 1:

filter_none

edit
close

play_arrow

link
brightness_4
code

<!DOCTYPE html>
<html>
  
<head>
    <title>
        HTML5: How to define
        a paragraph?
    </title>
</head>
  
<body>
    <h2>
        GeeksForGeeks
    </h2>
    <h2>
        HTML5: How to define 
        a paragraph?
    </h2>
    <p>
        A Computer Science 
        portal for geeks.
    </p>
  
    <p>
        It contains well written, 
        well thought articles.
    </p>
</body>
  
</html

chevron_right


Output:

Example 2:



filter_none

edit
close

play_arrow

link
brightness_4
code

<!DOCTYPE html>
<html>
  
<head>
    <title>
        HTML5: How to define a paragraph?
    </title>
</head>
  
<body>
    <h2>
        GeeksForGeeks
    </h2>
    <h2>
        HTML5: How to define a paragraph?
    </h2>
    <p>
        This paragraph has multiple
        lines. But HTML reduces them
        to a single line, omitting
        the carriage return we have used.
    </p>
  
    <p>
        This paragraph has multiple
        spaces. But HTML reduces them
        all to a single space, omitting
        the extra spaces and line 
        we have used.
    </p>
</body>
  
</html>

chevron_right


Output:

Supported Browsers:

  • Google Chrome
  • Internet Explorer
  • Firefox
  • Opera
  • Safari

full-stack-img




My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.