Skip to content
Related Articles

Related Articles

How to change the color of horizontal line (<hr> element) using CSS ?

View Discussion
Improve Article
Save Article
  • Last Updated : 18 Nov, 2020

The HTML <hr> tag is used to insert a horizontal rule or a thematic break in an HTML page to divide or separate document sections. The color of the <hr> tag can be set by using the background-color property in CSS.


<!DOCTYPE html>
<html lang="en">
    <meta charset="utf-8">
        hr {
            height: 4px;
            background-color: red;
            border: none;
        How to Changing the co lor 
        of an hr element using CSS?
    <p>This is a paragraph</p>
    <p>This is another paragraph</p>


Supported browsers are listed below:

  • Google Chrome
  • Internet Explorer
  • Firefox
  • Safari
  • Opera
My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!