HTML - Horizontal Rule
Horizontal Rule Description
Horizontal rule tag <hr/> is a non-breaking tag i.e it does not have a separate closing tag. It is used to draw a horizontal separator which can act as a separator. It can be used as-is without any additional attributes. However, attributes such as align and width can be used to control the behavior of the tag. For instance:
horizontal rule color and shade
<hr size="8" color="green"/> <br/> <hr size="8" color="maroon"/> <br/> <hr size="8" color="navy"/> <br/> <hr size="8" color="red"/> <br/> <hr size="8" color="red" noshade=""/> <br/> |
This is how it will appear in a browser |
View above example output in a new browser window |
Horizontal Rule Sample Code
<p>normal</p> <hr/> <p>center</p> <hr width="50%" align="center"/> <p>left </p> <hr width="50%" align="left"/> <p>right</p> <hr width="50%" align="right"/> |
This is how it will appear in a browser |
normal center left right |
View above example output in a new browser window |
horizontal rule width code
<hr/> <br/> <hr size="2"/> <br/> <hr size="8"/> <br/> <hr size="20"/> <br/> |
This is how it will appear in a browser |
View above example output in a new browser window |