hr color html code example
Example 1: how to change the color of the hr tag in html
<style>
hr{
height: 1px;
background-color: #ccc;
border: none;
}
</style>
Example 2: css hr color
hr { border: 0; border-top: 1px solid #dee2e6; }
Example 3: html horizontal line style
<!-- HTML -->
<!-- You can change the style of the horizontal line like this: -->
<hr style="width:50%", size="3", color=black>
<!-- Or like this: -->
<hr style="height:2px; width:50%; border-width:0; color:red; background-color:red">
Example 4: how to style an hr tag
hr.new1 {
border-top: 1px solid red;
}
hr.new2 {
border-top: 1px dashed red;
}
hr.new3 {
border-top: 1px dotted red;
}
hr.new4 {
border: 1px solid red;
}
hr.new5 {
border: 10px solid green;
border-radius: 5px;
}
Example 5: add color to hr tag
<style>
hr.new1 {
border-top: 1px solid red;
}
hr.new2 {
border-top: 1px dashed red;
}
hr.new3 {
border-top: 1px dotted red;
}
hr.new4 {
border: 1px solid red;
}
hr.new5 {
border: 10px solid green;
border-radius: 5px;
}
</style>
<h2>Style HR</h2>
<p>Default:</p>
<hr>
<p>Different styles of HR:</p>
<hr class="new1">
<hr class="new2">
<hr class="new3">
<hr class="new4">
<hr class="new5">
Example 6: add color to hr tag
border: 1px solid red;