HTML 5 - Elements: Horizontal Line
04-05-2017    1746 times
HTML Horizontal Line

Introduction

<hr> tag is use for the place a horizontal line on the page.

Width of Horizontal Line

By default the width of the line is 100%. But we can set the width of the line by using width attribute of the <hr> tag.

Full Width Line


Width is 50%


Tutorial at home

Alignment of the Horizontal Line

By default the alignment of the line is center. But we can set or alter the alignment of the line by using align attribute of the <hr> tag. This attribute only act when the value of width attribute changed.

Center align line


Alignment set to left.


Color of the Horizontal Line

By default the colour of the line is gray. But we can change it by the color attribute.

Alignment set to left.


Tutorial at home

Complete Example

Full Width Line
<hr>

Width is 50% default alignment is center.
<hr width="50%" />

 

Width is 50%. Set the alignment is left.
<hr align="left" width="50%" />

 

Red Color Line
<hr width="50%" />

 

 

HR Tag
HR Tag
freenotes
    Author Details
Arnab De
I have over 16 years of experience working as an IT professional, ranging from teaching at my own institute to being a computer faculty at different leading institute across Kolkata. I also work as a web developer and designer, having worked for renowned companies and brand. Through tutorialathome, I wish to share my years of knowledge with the readers.
    Related Post
  Query About the post