HTML Paragraph
HTML paragraph is a tag 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.
Using the br tag with paragraph:
The br tag in HTML is used for line breaks 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>
Explanation:
In this example, we can check the behavior of the 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>
Explanation:
In this example, we can check the behavior of hr tag between two paragraphs.