Table of Contents

What is HTML Paragraph?

HTML < p > tag is use for representing paragraph. If you want to write a paragraph in your HTML document then a paragraph tag is used.

Syntax- < p >Write your paragraph here. </ p >

 Example-

				
					<!DOCTYPE html>
<html>
<head>
    <title>Paragraph tag</title>
</head>

<body data-rsssl=1>
    <h2>Geeky4u.com (Learn with Passion)</h2>
    <p>
      Geeky4u.com (Learn with Passion). This is a best platform where we are
      providing best study material, best content so that it is easy for you to
      learn everything and no one will stop you to become a master in
      programming language
    </p>
</body>
</html>

				
			

Output:

7.1

Example Explain-

In the above example, whatever the content or text is written in between < p > </ p > are consider as a paragraph and it will display on your browser in the format like a paragraph.

What is the use of br tag in HTML Paragraph?

In HTML Paragraph br tag is used for a line break. If you wish to write a song, address or poem them the format for the poem or song must need a line break. For the line break, br tag is used. Br tag does not consist of the closing tag. Br tag is used at the end of the line where you want to break the particular line with no closing tag. It is very easy to use br tag in HTML paragraph and make your paragraph so attractive and user efficient.

Syntax-  Line or text < br >

Example-

				
					<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>br tag</title>
</head>
<body data-rsssl=1>
    <p>
    GEEKY4U.com (learn with passion) <br>
    GEEKY4U.com (learn with passion) <br>
    GEEKY4U.com (learn with passion) <br>
    GEEKY4U.com (learn with passion) <br>
    </p>
</body>
</html>

				
			

Output:

7.2

What is the concept of hr tag in HTML Paragraph?

The horizontal rule in HTML is used in a paragraph, if the user wishes to add some line spacing between the paragraph like shift spacing or thematic break then the concept of the horizontal rule is used. In HTML < hr > tag represents horizontal rule in your HTML document. < hr > tag use in between the paragraph tag for providing line spacing between the paragraph. < hr > tag does not have an end tag.

Example-

				
					<!DOCTYPE html>
<html>
<head>
            <title>hr tag</title>
</head>
    <body data-rsssl=1>
        <h1>My main heading</h1>
        
        <p>
        Horizontal rule in html is use in paragraph, 
        if user wish to add some line spacing between the paragraph 
        like shift spacing or thematic break then the concept of horizontal rule is used.
        </p>
        <hr>
        
        In HTML <hr> tag represents horizontal rule in your html document. 
        <hr> tag use in between the paragraph tag for providing line spacing between the paragraph.
        <hr> tag does not have end tag. 
    </body>
</html>


				
			

Output:

7.3

What is the use of align attribute in HTML Paragraphs?

In HTML Paragraph, align is a special attribute that is given to the text of your HTML Paragraph for making your text document Right align, Left align, or center align or justify respectively.

There are 4 types of align attributes in HTML paragraph-

Right align– Right align attribute is used to set your HTML paragraph into right align. Whatever the text you will write under the right align it will display at the right corner of your HTML page.

Left align- Left align attribute is used to set your HTML paragraph into left align. Whatever the text you will write under the left align it will display at the very left corner of your HTML page.

Center align- Center align attribute is used to set your HTML paragraph into center align. Whatever the text you will write under the center align it will display at the center of your HTML page.

Justify- It will help your HTML paragraph to extend your paragraph text for making the width of all the lines equal.

Syntax-

< p align=”left” > </ p >

< p align=”right” > </ p >

< p align=”center”> </ p >

Example-

				
					<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>align attribute</title>
</head>
<body data-rsssl=1>
    <h1> GEEKY4U.com (learn with passion) </h1>
    <h3>
    <p align="left"> 
     GEEKY4U.com (learn with passion)
    </p>
    <p align="center"> 
     GEEKY4U.com (learn with passion)
    </p>
    <p align="right"> 
    GEEKY4U.com (learn with passion)
    </p>
    </h3>    
</body>
</html>

				
			

Output:

7.4

What is the concept of pre-element in HTML Paragraph?

HTML paragraph does not allow the line spacing or formatted text, whatever you write in the paragraph including spaces, line break, etc. the browser will display the output without any spacing or line break. The browser will discard all the formatting and display only the plain text. If you wish to write a text in poem format or in song format then pre-element is used.

Syntax-  < pre > Your text </ pre >

Example-

				
					<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>pre element</title>
</head>
<body data-rsssl=1>
    <pre>
    GEEKY4U.com (learn with passion)                     GEEKY4U.com (learn with passion) 

    GEEKY4U.com (learn with passion)                     GEEKY4U.com (learn with passion)
    </pre>
</body>
</html>

				
			

Output:

7.5