0% found this document useful (0 votes)
42 views

10.HTML Paragraph

The document discusses the HTML <p> paragraph tag. It explains that the <p> tag defines a paragraph on a webpage and browsers automatically add spacing before and after paragraphs. It also notes that extra spaces and lines within <p> tags are ignored/removed by browsers. The document provides examples of using the <br> line break tag and <hr> horizontal rule tag within paragraphs.

Uploaded by

Hashiim Tahir
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
42 views

10.HTML Paragraph

The document discusses the HTML <p> paragraph tag. It explains that the <p> tag defines a paragraph on a webpage and browsers automatically add spacing before and after paragraphs. It also notes that extra spaces and lines within <p> tags are ignored/removed by browsers. The document provides examples of using the <br> line break tag and <hr> horizontal rule tag within paragraphs.

Uploaded by

Hashiim Tahir
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

HTML Paragraph

HTML Paragraph
HTML paragraph or HTML p tag is used to define a paragraph in a webpage. Let's take a simple example to see how it work. It is
a notable point that a browser itself add an empty line before and after a paragraph. An HTML <p> tag indicates starting of new
paragraph.

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

1. <p>This is first paragraph.</p>
2. <p>This is second paragraph.</p>
3. <p>This is third paragraph.</p>

Output:

This is first paragraph.

This is second paragraph.

This is third paragraph.

Space inside HTML Paragraph


If you put a lot of spaces inside the HTML p tag, browser removes extra spaces and extra line while displaying the page. The
browser counts number of spaces and lines as a single one.

1. <p>
2. I am
3. going to provide
4. you a tutorial on HTML
5. and hope that it will
6. be very beneficial for you.
7. </p>
8. <p>
9. Look, I put here a lot
10. of spaces  but   I know, Browser will ignore it. 
11. </p>
12. <p>
13. You cannot determine the display of HTML</p>
14. <p>because resized windows may create different result.
15. </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 extra lines and unnecessary spaces are removed by the browser.

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


An HTML <br> tag is used for line break and it can be used with paragraph elements. Following is the example to show how to
use <br> with <p> element.

Example:

1. <!DOCTYPE html>
2. <html>
3. <head>
4. </head>
5. <body>
6. <h2> Use of line break with pragraph tag</h2>
7. <p><br>Papa and mama, and baby and Dot,
8. <br>Willie and me?the whole of the lot
9. <br>Of us all went over in Bimberlie's sleigh,

1/3
10. <br>To grandmama's house on Christmas day.
11. </p>
12. </body>
13. </html>

Output:

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

Example:

1. <!DOCTYPE html>
2. <html>
3. <head>
4. </head>
5. <body>
6. <h2> Example to show a horizontal line with paragraphs</h2>
7. <p> An HTML hr tag draw a horizontal line and separate two paragraphs with that line.<hr> it will start a new paragraph.
8. </p>
9. </body>
10. </html>

Output:

Supporting Browsers

Element Chrome IE Firefox Opera Safari

<p> Yes Yes Yes Yes Yes

2/3

You might also like