HTML paragraph or HTML p tag is utilized to characterize a paragraph in a webpage. How about we take a simple example to perceive how it work. It is a remarkable point that a browser itself add an empty line before and after a paragraph. An HTML <p> tag indicates beginning of new paragraph.

HTML tags


Note: If we are utilizing different <p> tags in single HTML file then browser automatically adds a single blank line between the two paragraphs.
See this example:

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

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

<p>This is third paragraph.</p>  
Output:

This is first paragraph.


This is second paragraph.


This is third paragraph.

Space inside HTML Paragraph

Assuming you put a great deal of spaces inside the HTML p tag, browser removes additional areas and extra line while showing the page. The browser counts number of spaces and lines as a solitary one.


<p> 

I am  

going to provide  

you a tutorial on HTML  

and hope that it will  

be very beneficial for you.  

</p>

<p>

Look, I put here a lot 

of spaces   but   I know, Browser 
will ignore it.  

</p>

<p>

You cannot determine the display of HTML</p>

<p>because resized windows may create 
different result.  

</p>
Output:

I am going to provide you a tutorial on HTML and hope that it will be very beneficial for you.

Look,I put here a lot of spaces but I know, Browser will ignore it.

You cannot determine the display of HTML

because resized windows may create different result.

As you can see, all the additional lines and unnecessary spaces are taken out by the browser.

How to Use <br/> and <hr/> tag with paragraph?

An HTML <br/> tag is utilized for line break and it can be utilized with paragraph components. Following is the example to tell the best way to use <br/> with <p> element.

Example:

<!DOCTYPE html>  

<html> 

   <head> 

   </head> 

  <body>

   <h2>
               Use of line break 
               with pragraph tag</h2> 

      <p>
<br/>Papa and mama, and baby and Dot,

<br/>Willie and me?the whole of the lot 

<br/>Of us all went over in Bimberlie's 
sleigh, 

<br/>To grandmama's house on Christmas day.  

       </p> 

   </body>  

</html>  
Output:

 Use of line break with pragraph tag

          


Papa and mama, and baby and Dot,        
Willie and me?the whole of the lot                  
Of us all went over in Bimberlie's sleigh,                   
To grandmama's house on Christmas day.             

An HTML <hr/> tag is utilized to apply a horizontal line between two statements or two paragraphs. Following is the example which is showing utilization of <hr/> tag with paragraph.

Example:

<!DOCTYPE html>  

<html> 

     <head> 

    </head> 

  <body> 

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

   <p> 
      An HTML hr tag draw a horizontal 
      line and separate two paragraphs 
      with that line.<hr/>it will start 
      a new paragraph.  

     </p> 

  </body>  

</html>    
Output:

Example to show a horizontal line with paragraphs

 An HTML hr tag draw a horizontal line and separate two paragraphs with that line.


it will start a new paragraph.


Previous                                                                                             Next