BCA SCHOOL
Programming Tutorials • Notes • Practical • Books
LATEST TUTORIALS

HTML Horizontal Rule

by BCA School

HTML Horizontal Rule

HTML Horizontal Rule renders a line in a web browser. It is an empty element.

The <hr /> element defines an HTML Horizontal Rule.

Look at the example below, to see how it works.

Example:

<p> This is a paragraph. </p>

<hr />

<p> This is a paragraph. </p>


Styling and Changing the Color of HTML

Horizontal Rules

In the example below you will learn how to style HTML Horizontal Rules

by changing its width and height.

To change its color we need to use the color attribute.

Example:

<!-- width -->

<hr style="width : 50%" color="black"

<!-- height-->

<hr style="height : 40px" color="black" />

<!-- Color--->

<hr color="gold" />