Skip to content
Related Articles

Related Articles

How to change the color of horizontal line (<hr> element) using CSS ?
  • 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.

Example:

filter_none

edit
close

play_arrow

link
brightness_4
code

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

chevron_right


Output:

Supported browsers are listed below:

  • Google Chrome
  • Internet Explorer
  • Firefox
  • Safari
  • Opera

full-stack-img

My Personal Notes arrow_drop_up
Recommended Articles
Page :