hr class bootstrap 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: 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 3: how to style an hr tag

/* Red border */
hr.new1 {
  border-top: 1px solid red;
}

/* Dashed red border */
hr.new2 {
  border-top: 1px dashed red;
}

/* Dotted red border */
hr.new3 {
  border-top: 1px dotted red;
}

/* Thick red border */
hr.new4 {
  border: 1px solid red;
}

/* Large rounded green border */
hr.new5 {
  border: 10px solid green;
  border-radius: 5px;
}

Example 4: which is right or in html

<hr> <!--   it represents a horizontal line break, in HTML4.0 we use <hr>, 
            in XHTML1.0 we use <hr/>,  in HTML5(which is the current version of 
            HTML) we can use both <hr> and <hr/>    
       -->

Tags:

Misc Example