How To Change The Color Of An HR Element Using CSS
Có thể bạn quan tâm
Topic: HTML / CSSPrev|Next
Answer: Use the CSS background-color Property
You can simply use the CSS background-color property in combination with the height and border to the change the default color an <hr> element.
In the following example we've changed the color of hr tag to light grey. You can also increase the thickness of the line by simply increasing the value of the height property.
Example
Try this code » <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>Change the Color of hr Tag using CSS</title> <style> hr{ height: 1px; background-color: #ccc; border: none; } </style> </head> <body> <p>This is a paragraph</p> <hr> <p>This is another paragraph</p> </body> </html>Related FAQ
Here are some more FAQ related to this topic:
- How to create triangle or caret icons using CSS
- How to add border to an element on mouse hover without affecting the layout in CSS
- How to remove outline around text input boxes in chrome using CSS
Advertisements Is this website helpful to you? Please give us a like, or share your feedback to help us improve. Connect with us on Facebook and Twitter for the latest updates.
About Us
Our Story Terms of Use Privacy PolicyContact
Contact Us Report Error AdvertiseInteractive Tools
Bootstrap Icon Search Utility HTML Formatter Title & Meta Length Calculator HTML Color Picker Bootstrap Button Generator SQL Playground Font Awesome Icon Finder HTML Editor
Copyright © 2025 Tutorial Republic. All Rights Reserved. Share This:
Từ khóa » Hr Properties Tag
-
HTML Hr Tag - W3Schools
-
: The Thematic Break (Horizontal Rule) Element - MDN Web Docs -
HTML
Tag - GeeksforGeeks -
HTML Horizontal Line – HR Tag Example - FreeCodeCamp
-
HTML -
Tag - Tutorialspoint -
HTML Hr Style Attribute - Dofactory
-
HTML
Tag - W3docs -
Html Hr Tag Properties Archives - KrTricks
-
Hr Css Properties Code Example - Code Grepper
-
HTML Horizontal Line – Learn How To Use The Hr Tag In HTML
-
HR Properties - ServiceNow Docs
-
Change Color Of HR Tag CSS - Linux Hint
-
Html.Hr - Dash For Python Documentation - Dash Plotly
-
Changing Properties Of All
Html Elements - Stack Overflow