<hr> Tag in HTML
The <hr> tag in HTML is used to represent a thematic break or horizontal rule in a webpage. It is typically used to separate sections of content, making the page more visually appealing and easier to read. The tag creates a horizontal line that spans the width of the container.
Key Points on <hr> Tag:
- The <hr> tag is a self-closing tag and does not require a closing tag.
- It is typically used to visually separate sections of a page.
- It can be styled using CSS to change its appearance, such as color, width, height, or style.
Syntax of <hr> Tag:
Syntax Example
<hr>
Example of <hr> Tag in HTML:
This example demonstrates how to use the <hr> tag to separate two sections of content.
Code Example
<h1>Section 1</h1>
<p>This is the first section of content.</p>
<hr>
<h1>Section 2</h1>
<p>This is the second section of content.</p>
Output
Section 1
This is the first section of content.Section 2
This is the second section of content.The <hr> tag is often used to improve the visual organization of a webpage. While it does not carry any semantic meaning, it helps in breaking up content into distinct parts. You can also use CSS to style the horizontal line, such as changing its thickness, color, and style (dashed, dotted, etc.).