Description
HTML element <hr> is used to produce a horizontal rule, which is displayed as a solid line across a web page.
It is an empty element, which doesn’t need a closing tag and content.
It is commonly used to produce a thematic break to separate different sections of the content.
The below table summarizes its usage.
| Usage Details | |
| Placement | It is displayed as a Block element. |
| Contents | None. It is an empty element. |
| Tags | Only an opening tag is required. |
| Versions | HTML 2,3.2, 4, 4.01, 5 |
Syntax
Here is the basic syntax of the <hr> element.
<hr>
Examples
Element <hr> used to produce a horizontal rule between two sections.
<h2>Section Heading</h2>
<p>Section content goes here...</p>
<hr>
<h2>Section Heading</h2>
<p>Section content goes here...</p>
Attributes
The following table shows the list of supported and unsupported attributes for the heading elements.
| Attribute Type | Details |
| Element-Specific Attributes | The tags <hr> doesn't have any element-specific attributes.All the attributes that existed in the past are obsolete and listed in the below table. |
| Global Attributes | Like all other HTML tags, the tag <hr> supports the HTML Global Attributes. |
| Event Attributes | The tags <hr> also supports the HTML Event Attributes. |
Here is a list of attributes that are specific to the <hr> element.
| Attribute | Value | Description |
align |
left, center, right |
Obsolete and should not use. Specifies the horizontal rule alignment with respect to the page. |
noshade |
noshade |
Obsolete and should not use. Specifies the horizontal rule with a solid bar without a 3D level/shading effect. |
size |
pixels | Obsolete and should not use. Specifies the height of the horizontal rule. |
width |
pixels (or) % | Obsolete and should not use. Specifies the width of the horizontal rule. |
Browser Compatibility
The tags <hr> is supported in all modern browsers.
- Google Chrome 1+
- Internet Explorer or Edge 2+
- Firefox 1+
- Apple Safari 1+
- Opera 4+