HTML Paragraphs

HTML Paragraphs tag defined by <p> tag. It is a open and closed tag. Some developer add only open tag but it not give proper result so it is necessary to add closing tag. It used inside a body tag. 

Example:

 

 

<!DOCTYPE html>

<html lang="en">

<head>

        <meta charset="UTF-8">

        <title>Title</title>

</head>

<body>

        <p> Hi this is the render_template</p>

</body>

</html>

Some important key points regarding paragraphs:

  • It removes extra spaces automatically between inside the line.

       

 

 

 

Result:

                  Hi, this is the codersart tutorial

  • It occupy space before and after the lines the lines

       

 

 

Result:

              This is first paragraph.

              This is second paragraph

Example.

                                         <p>

                                                  Hi,     this is the        codersart tutorial

                                     </p>

Example. 

                                                   <p>This is first paragraph.</p>  

                                     <p>This is second paragraph.</p> 

  • Use of <br> and  <hr> tag inside paragraph

<br> tag is used to break the line, when we want to switch another line then used <br> tag

       

 

 

 

 

 

 

 

 

 

Result:

             This paragraph has multiple

              lines. But HTML reduces them

           

<hr> tag is used to apply a horizontal line between two statements or two paragraphs.

Example.

                                                   <body>

                                            <p>

                                                      This paragraph has multiple<br>

                                                       lines. But HTML reduces them<br>

                                           </p>

                                     </body>

Example.

                                     <body>

                                            <h2> Example to show a horizontal line</h2>  

                                             <p>HTML <hr> it will start a new paragraph. </p>  

                                     </body

Result:

  • <align> attribute inside paragraphs tag

The <p> tag specifically supports the alignment attribute and allows us to align our paragraphs in left, right or center alignment.         

Example. 

                                                  <body>

                                            <p align="center">Welcome Codersarts</p>

                                    </body>

Conclusion

In this tutorial, we learn most of the attributes and tags which used to maintain the paragraphs. In this we covers all the important elements of paragraph tags if anything is missing then please suggest so we can make it better for you to give perfect tutorials.

Powered  by Codersarts