How to change the color of horizontal line (<hr> element) using CSS ?
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:
<!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 > |
Output:
Supported browsers are listed below:
- Google Chrome
- Internet Explorer
- Firefox
- Safari
- Opera