Paragraph tag in HTML

HTML Paragraph

HTML paragraph is a tag which is used to specify a paragraph to be displayed on the webpage. The text between the starting <p> tag and the end </p> tag represents a paragraph in HTML. There is however no need to add a line of separation before and after a paragraph since an empty line is added before and after a paragraph by the browser itself. Including Chrome, Internet Explorer, Opera, Safari and Firefox, all the popular browsers supports the HTML paragraph tag.

Example:

<!DOCTYPE html>
<html>
<head>
<title>Example</title>
</head>
<body>
<p>Hello World!!</p>
<p>I am an HTML Paragraph.</p>
</body>
</html>

Output:




Example


Hello World!!

I am an HTML Paragraph.

Explanation:
In this example, we can check the behaviour of the HTML paragraph tag and element. An empty line is also added between the two paragraphs.

Space in between a Paragraph:
Extra spaces and extra lines are eliminated by the browser itself while displaying the paragraph on the webpage and display only a single space and a single line.

Example:

<!DOCTYPE html>
<html>
<head>
<title>Example</title>
</head>
<body>
<p> Hello                          World!! </p>
<p>I am 
 
an HTML Paragraph.</p>
</body>
</html>

Output:




Example


Hello World!!

I am an HTML Paragraph.

Explanation:
In this example, all the unnecessary spaces and extra lines are eliminated by the browser itself while displaying the paragraph on the webpage.

Using the br tag with paragraph:
The br tag in HTML is used for line break within a paragraph element.

Example:

<!DOCTYPE html>
<html>
<head>
<title>Example</title>
</head>
<body>
<p>Hello World!!</p>
<p>I am an HTML Paragraph.<br>How are you all?<br> Have a great day ahead!</p>
</body>
</html>

Output:




Example


Hello World!!

I am an HTML Paragraph.
How are you all?
Have a great day ahead!

Explanation:
In this example, we can check the behaviour of br tag within a paragraph element.

Using the hr tag with paragraph:
The hr tag in HTML is used to apply a horizontal line within a paragraph or between two paragraphs.

Example:

<!DOCTYPE html>
<html>
<head>
<title>Example</title>
</head>
<body>
<p>Hello World!!</p><hr>
<p>I am an HTML Paragraph.</p>
</body>
</html>

Output:




Example


Hello World!!


I am an HTML Paragraph.

Explanation:
In this example, we can check the behaviour of hr tag between two paragraphs.

Please Share