HTML <hr> tag
The <hr> tag is used to display a horizontal line on a page.
NOTE: The <hr> tag does not have a closing tag
Attributes
| Attribute | Description | Possible values |
|---|---|---|
| align | Sets the alignment of the horizontal line | left, center, right |
| noshade | Sets a horizontal line in one solid color, instead of it being shaded | noshade |
| size | Sets the height of a horizontal line in pixels | numericValue |
| width | Sets the width of a horizontal line in pixels or percentage | numericValue, % |
NOTE: All of the attributes of the <hr> tag are deprecated.
Standard attributes
class, dir, id, lang, style, title, xml:lang
For more information on standard attributes, check out our HTML standard attributes reference page.
Event attributes
onclick, ondblclick, onmousedown, onmousemove, onmouseout, onmouseover, onmouseup, onkeydown, onkeypress, onkeyup
For more information on event attributes, check out our HTML event attributes reference page.
Example
<h1>HTML</h1>
<hr width="90%" align="left" />
HTML stands for Hyper Text Markup Language and it is used to build webpages.
<h1>..Attention..</h1>
<hr width="50%" align="left" />
This is a message from your television station. We will be broadcasting
nothing but cartoons from now on
Output:
HTML stands for Hyper Text Markup Language and it is used to build webpages.
This is a message from your television station. We will be broadcasting nothing but cartoons from now on
HTML
HTML stands for Hyper Text Markup Language and it is used to build webpages.
..Attention..
This is a message from your television station. We will be broadcasting nothing but cartoons from now on
Tips & notes
You can use the <hr> tag to separate content in a meaningful way on a webpage.
You can use CSS to set the styles (such as the color and the width) of a horizontal line.