HTML Horizontal Rule

Create Lines to Separate Sections Of Your Page

When you want to create a horizontal line across your page you will use the Horizontal Rule element (<hr />). Using the <hr /> element will create a new line and stretch a horizontal line across the width of its containing element.

The horizontal rule tag is another tag that doesn't require a closing tag since it is a self contained element and includes the slash at the end of the opening tag. Lets see how it works.

Html Code:

This Text Will be followed by a horizontal line.<hr />

<h2>This is a Heading</h2>
<hr />

Browser Display:

This Text Will be followed by a horizontal line.



This is a Heading


As with most elements, you can apply style attributes to horizontal rules as well.

Html Code::

This Text Will be followed by a red horizontal line.
<hr style="color:red;" />
	

Browser Display:

This Text Will be followed by a red horizontal line.