CSS

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

Title


Lorem ipsum dolor sit amet, consectetur adipiscing elit.

mcqMCQPractice competitive and technical Multiple Choice Questions and Answers (MCQs) with simple and logical explanations to prepare for tests and interviews.Read More

Leave a Reply

Your email address will not be published. Required fields are marked *