Style HTML HR Tag

 

Style HTML HR Tag

The HORIZONTAL RULE tag is used to divide subjects within a web page. In HTML5, the <hr> tag specifies a thematic break. In HTML4 it specifies a horizontal rule. As the <hr> attributes are not supported in HTML5, you can style the tag using CSS.

Height

You can specify the height of an HTML <hr> tag with CSS.

In the following example, the horizontal rule is displayed with the height set to 3:

page divider

<hr style="height:3px;" />

In the next example, the <hr> tag is displayed with the height set to 6:

page divider

<hr style="height:6px;" />

Width

You can specify the width of an HTML <hr> tag with CSS.

In the following example, the <hr> tag is displayed with the width set to 50%:

line

<hr style="width:50%;" />

Color

In the following example, the <hr> tag is displayed in the color red with a width of 75% and a height of 4:

page divider

<hr style="color: #FF0000; width:75%; height:4em" />

In the following example, the <hr> tag is displayed in the color blue with a width of 25% and a size of 6:

page divider

<hr style="color: #6699ff; width:25%; height:6em" />

 

Border

Solid

In the following example, the horizontal rule is displayed with a solid border:

line

<hr style="border:1px solid #000; width="100" />

Dashed

In the following example, the horizontal rule is displayed with a dashed border:

line

<hr style="border:1px dashed #000; width="100" />

Styling your <hr> tag will enable you to enhance the appearance of your website.

For additional information on HTML codes, visit the HTML Tutorial section.

This concludes the Style HTML HR Tag code.
 

 

 
Visit the following pages for a wealth of copy and paste codes and tips:

HTML Tips
Copy and paste special effect HTML codes for your web page.

HTML Codes
An HTML codes chart you can use to copy and paste codes into your web page.

HTML Color Codes
An HTML color codes chart you can use to copy and paste color codes into your web page.

JavaScript Codes
Copy and paste special effect JavaScript codes for your web page.

Web Design Tips
Tips, tricks, and special effect codes for your web page.

HTML Tags
A list of HTML tags.

HTML 5 Tags
A list of the latest HTML tags to be developed.

ASCII Codes
Special text characters and code for your web page.