HTML Paragraph with Examples

HTML Paragraph is used to define the paragraph written on the webpage. HTML Paragraph is assembled as related visual content on the webpage. Let us understand HTML Paragraph in detail.

HTML Paragraph features 

  • HTML Paragraph takes all the width available on the line.
  • Because it is a Block-Level HTML Element.
  • HTML Paragraph renders the gap of the written source text code and displays without it on the webpage.
  • HTML Paragraph is  case sensitive .
  • The alignment of the HTML Paragraph is done by attributes.

Syntax of HTML Paragraph 

<h1> content </h1>

  • Paragraph tags start from opening bracket and lowercase p then the a closing bracket  <p>  with content to display  in between  and ends with the opening bracket and backslash with lowercase p and closing bracket </p>.

Example of HTML Paragraph 

Eg 1. Alignment In Paragraph :

<!DOCTYPE html> 
< html > 
<head> 
    <title>Paragraph</title> 
</head> 
<body> 
    <p align="center">Welcome to codedec</p> 
    <p align="left">A programming  
                  place for coders.</p> 
    <p align="right">learn from scratch.</p> 
</body> 
</html> 

       Output :

 Eg.2  Paragraph use in Line Break Tag :

<!DOCTYPE html>

<html>

<body>

<p>WELCOME TO<br>CODEDEC WEBSITE<br>WITH LINE BREAKS.</p>

</body>

</html>

​

       Output :

                                                          

 

Eg.3 Paragraph used with  Pre Tag :

<!DOCTYPE html>
<html>
<body>

<p>margin of space and line break together :</p>

<pre>
   learn how to code .
   
   programming language is the new cool
   
   codedec is platform to improve coding skills.
   
   happy learnig
</pre>

</body>
</html>

 Output :

                          

Eg.4  Paragraph used with hr Tag :

<!DOCTYPE html>
<html>
<body>

<h1>first heading</h1>
<p> welcome to codedec.</p>
<hr>

<h2> start learning program</h2>
<p> feedback.</p>
<hr>


</body>
</html>

 Output :