CodesJava

Easy learning with example program codes

P | paragraph HTML

HTML <p> Tag

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:

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:

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>

Output:

Explanation:

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

Please follow and like us:
error
Posted in HTML   









Copyright © 2019 CodesJava DMCA.com Protection Status