Horizontal line is used in webpage to separate one block of content from another.
Horizontal rules must occupy a line by themselves and cannot appear within a paragraph.
<HR> tag is used to add a horizontal line. Just put this tag where you want to draw a line and you will see the line there.
Thickness and length of a horizontal line can be defined using the SIZE and WIDTH attributes.
Let us see the structure:
<HR SIZE=”X” WIDTH=”Y%”>
X is the thickness in pixel and Y is the % of page you want the line to extend.
By default, the browser displays horizontal rules with shading, giving the lines a three-dimensional effect.
How do I make line appear solid?
- This can be done using NOSHADE attribute within <HR> tag. It will appear like
How to change color of horizontal line?
- This can be done using COLOR attribute within <HR> tag. It will appear like
- Replace ????? with the color code as given in this table.
See the video below: