How to Create a Horizontal Line in HTML


Below this paragraph is a horizontal line that creates a horizontal divide in this page. This can function to break up content and make it more organized and, thus, more visually appealing.

To create a horizontal line in a web page, all you have to do is enter:


This tag will create the horizontal line that you see above.

If you don't see the horizontal line when you add the hr tag, go to the CSS file and edit the tag so that its border is solid.

This is how the hr tag should look in your CSS file:

hr {border:solid}

This should solve the problem.

Specifying Dimensions of HR

When you create a horizontal line, you can also specify its height, width, and alignment by using the size, width, and align attributes. So you can make it taller or shorter vertically in height, longer or shorter horizontally in width, or aligned to the left, center, or right in alignment.

The line below uses a border that only covers half of the page's width and is center aligned:

The code to produce the above line in HTML is:

<hr width="50%" align=center>

HTML Comment Box is loading comments...