How to change the color of HR tag with CSS
In this tutorial, we are going to see how to change the color of HR tag with CSS. You can easily use the background-color attribute in combination with height and border properties to modify the default color of the <hr> tag.
Source Code:
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Change the color of HR tag with CSS</title> <style> hr{ height: 3px; background-color: #ff7d95; border: none; } </style> </head> <body> <h1>Title</h1> <hr> <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p> </body> </html>
Result |
---|
TitleLorem ipsum dolor sit amet, consectetur adipiscing elit. |

- HTML/CSS MCQs – Multiple Choice Questions and Answers – Part 1
- HTML/CSS MCQs – Multiple Choice Questions and Answers – Part 2
- HTML/CSS MCQs – Multiple Choice Questions and Answers – Part 3
- HTML/CSS MCQs – Multiple Choice Questions and Answers – Part 4
- HTML/CSS MCQs – Multiple Choice Questions and Answers – Part 5
- HTML/CSS MCQs – Multiple Choice Questions and Answers – Part 6
- HTML/CSS MCQs – Multiple Choice Questions and Answers – Part 7
- HTML/CSS MCQs – Multiple Choice Questions and Answers – Part 8
- HTML/CSS MCQs – Multiple Choice Questions and Answers – Part 9
- HTML/CSS MCQs – Multiple Choice Questions and Answers – Part 10
- HTML/CSS MCQs – Multiple Choice Questions and Answers – Part 11
- HTML/CSS MCQs – Multiple Choice Questions and Answers – Part 12
- HTML/CSS MCQs – Multiple Choice Questions and Answers – Part 13
- HTML/CSS MCQs – Multiple Choice Questions and Answers – Part 14
- HTML/CSS MCQs – Multiple Choice Questions and Answers – Part 15
- HTML/CSS MCQs – Multiple Choice Questions and Answers – Part 16
- HTML/CSS MCQs – Multiple Choice Questions and Answers – Part 17
- HTML/CSS MCQs – Multiple Choice Questions and Answers – Part 18
- HTML/CSS MCQs – Multiple Choice Questions and Answers – Part 19
- HTML/CSS MCQs – Multiple Choice Questions and Answers – Part 20
- HTML/CSS MCQs – Multiple Choice Questions and Answers – Part 21
- HTML/CSS MCQs – Multiple Choice Questions and Answers – Part 22
- HTML/CSS MCQs – Multiple Choice Questions and Answers – Part 23
- HTML/CSS MCQs – Multiple Choice Questions and Answers – Part 24
- HTML/CSS MCQs – Multiple Choice Questions and Answers – Part 25
- HTML/CSS MCQs – Multiple Choice Questions and Answers – Part 26
- HTML/CSS MCQs – Multiple Choice Questions and Answers – Part 27
- HTML/CSS MCQs – Multiple Choice Questions and Answers – Part 28
- HTML/CSS MCQs – Multiple Choice Questions and Answers – Part 29
- HTML/CSS MCQs – Multiple Choice Questions and Answers – Part 30
- HTML/CSS MCQs – Multiple Choice Questions and Answers – Part 31
- HTML/CSS MCQs – Multiple Choice Questions and Answers – Part 32
- HTML/CSS MCQs – Multiple Choice Questions and Answers – Part 33
- HTML/CSS MCQs – Multiple Choice Questions and Answers – Part 34
- HTML/CSS MCQs – Multiple Choice Questions and Answers – Part 35
- HTML/CSS MCQs – Multiple Choice Questions and Answers – Part 36
- HTML/CSS MCQs – Multiple Choice Questions and Answers – Part 37
- HTML/CSS MCQs – Multiple Choice Questions and Answers – Part 38
- HTML/CSS MCQs – Multiple Choice Questions and Answers – Part 39
- HTML/CSS MCQs – Multiple Choice Questions and Answers – Part 40
- HTML/CSS MCQs – Multiple Choice Questions and Answers – Part 41
- HTML/CSS MCQs – Multiple Choice Questions and Answers – Part 42
- HTML/CSS MCQs – Multiple Choice Questions and Answers – Part 43
- HTML/CSS MCQs – Multiple Choice Questions and Answers – Part 44
- HTML/CSS MCQs – Multiple Choice Questions and Answers – Part 45
- HTML/CSS MCQs – Multiple Choice Questions and Answers – Part 46
- HTML/CSS MCQs – Multiple Choice Questions and Answers – Part 47
- HTML/CSS MCQs – Multiple Choice Questions and Answers – Part 48
- HTML/CSS MCQs – Multiple Choice Questions and Answers – Part 49
- HTML/CSS MCQs – Multiple Choice Questions and Answers – Part 50
- HTML/CSS MCQs – Multiple Choice Questions and Answers – Part 51
- HTML/CSS MCQs – Multiple Choice Questions and Answers – Part 52
- HTML/CSS MCQs – Multiple Choice Questions and Answers – Part 53
- HTML/CSS MCQs – Multiple Choice Questions and Answers – Part 54
- HTML/CSS MCQs – Multiple Choice Questions and Answers – Part 55
- HTML/CSS MCQs – Multiple Choice Questions and Answers – Part 56
- HTML/CSS MCQs – Multiple Choice Questions and Answers – Part 57
- HTML/CSS MCQs – Multiple Choice Questions and Answers – Part 58
- Contact form with HTML, CSS, and Javascript
- Customize radio buttons using CSS
- Customize checkbox using CSS
- How to Style Select Option Dropdown with only CSS
- Styling an input type=”file” button with CSS
- How to write comments in HTML
- How to write comments in CSS
- How to vertically center an image in a DIV using CSS
- How to Disable a Link using Only CSS
- How to Resize Background Images with CSS3
- How to overlay one DIV over another div using CSS
- How to create a list without bullets in HTML
- How to dynamically change the width and height of DIV based on content using CSS
- How to Center Text Vertically in DIV with CSS
- How to Set the Height of a DIV to 100% with CSS
- How to Horizontally Center a DIV with CSS
- How to change the color of HR tag with CSS
- How to Auto-resize an Image to Fit into a DIV Container using CSS
- How to change the cursor into a hand when a user hovers over a list item?
- How to Draw a Vertical Line in HTML
- How to Change Background Opacity without Affecting Text
- How to Remove White Space Under an Image Using CSS
- How to Make a Button Link to Another Page in HTML
- How To Write Text Over an Image in HTML With CSS
- How to Make a Custom Cursor Using CSS
- How to use shadow effect on HTML elements using CSS
- How to add shadow to text in CSS
- How to Change Text Color on Hover in CSS
- How to Make a DIV Element Editable in HTML
- How to Change Image on Hover with CSS
- How to style div with an inner border inside a div using CSS
- How to Place Two DIVs with Same Height Side by Side in CSS
- How to remove spaces between cells in the HTML table
- How to Disable the Resizing of Textarea Using CSS
- How to Style CSS Checkboxes with Font Awesome