Horizontal lines are produced by using the hr tag. This tag has no closing one. The size and width attributes allow you to modify the height and the width of the line. The hr tag has the following syntax:
The width can be given in pixels or as a percentage of the width of the element including the line (table cell, frame, or the entire document).
Examples:
Layout | HTML tags |
---|---|
<hr size="12" width="100%" /> | |
<hr size="6" width="50%" /> | |
<hr size="3" width="25%" /> | |
<hr size="1" width="10%" /> |
The noshade attribute supported by both Netscape Navigator and Internet Explorer allows you to create horizontal lines without 3D shading. Here are two horizontal lines, with and without the noshade attribute.
Layout | HTML tags |
---|---|
<hr width="75%" /> | |
<hr noshade="noshade" width="75%" /> |
You can also use the color attribute to specify the line color as it is shown below.
Layout | HTML tags |
---|---|
<hr color="red" width="75%" /> | |
<hr color="green" width="75%" /> | |
<hr color="blue" width="75%" /> |