In HTML, you can use the <hr>
(horizontal rule) element to create a horizontal line, typically used to separate content sections. To set the color of the <hr>
element, you can use the CSS border-color property. Here's an example of how to do it:
<!DOCTYPE html>
<html>
<head>
<style>
/* CSS to set the color of the <hr> element */
hr {
border-color: red; /* You can replace "red"
with any color you want */
}
</style>
</head>
<body>
<h2>Content Section 1</h2>
<p>This is the content of section 1.</p>
<hr>
<h2>Content Section 2</h2>
<p>This is the content of section 2.</p>
<hr>
</body>
</html>
In this example, the <hr>
element will have a red color. You can replace "red" with any valid CSS color value (e.g., hexadecimal, RGB, color name) to achieve the color you want for the horizontal line.
Thank You