P | paragraph HTML

HTML <p> Tag

HTML paragraph is a tag that 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 support 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>

Explanation:

In this example, we can check the behavior 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 displays 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>

Explanation:

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

Example: Using the <br> tag with paragraph:

<!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>

Explanation:

In this example, we can check the behavior of <br> tag within a paragraph element.

Global attributes:

The HTML global attributes are supported by the HTML <p> tag.

Event attributes:

The HTML event attributes are supported by the HTML <p> tag.

Supporting Browsers:

Chrome, IE, Firefox, Opera, and Safari.