HTML Paragraph Tag

The HTML <p> tag is used to create paragraphs on a webpage. A paragraph contains a block of text that is separated from other content by automatic spacing. Paragraphs help organize information, making webpages easier to read and understand. Browsers automatically add a small margin before and after each paragraph.


Syntax


<p>

    This is a paragraph.

</p>


Example


<!DOCTYPE html>

<html>


<head>

    <title>Paragraph Example</title>

</head>



<body>


    <p>This is the first paragraph.</p>


    <p>This is the second paragraph.</p>



</body>



</html>

Output

This is the first paragraph.

This is the second paragraph.


HTML Line Break (<br>)

The <br> tag is used to insert a line break without starting a new paragraph. It is useful for writing poems, addresses, or content that requires a new line.

Syntax


<br>

Example


Hello<br>

Welcome to HTML<br>

Learning

Output

Hello
Welcome to HTML
Learning


HTML Horizontal Line (<hr>)

The <hr> tag is used to create a horizontal line across the webpage. It is commonly used to separate different sections of content.

Syntax


<hr>

Example


<p>HTML Tutorial</p>


<hr>


<p>CSS Tutorial</p>

Output

HTML Tutorial


CSS Tutorial


HTML Comments

HTML comments are used to write notes inside the HTML code. Comments are ignored by web browsers and are not displayed on the webpage. They help developers understand and maintain the code.

Syntax


<!-- This is a comment -->

Example


<!-- Website Header -->


<h1>Welcome</h1>


<!-- End of Header -->


Best Practices

  • Use the <p> tag for paragraphs of text.
  • Use <br> only when a line break is required.
  • Use <hr> to separate different sections.
  • Write meaningful comments to explain important code.
  • Keep paragraphs short for better readability.
  • Avoid using multiple <br> tags for spacing.