how to create a horizontal line in html code example

Example 1: 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 2: how to horizontal line in html

<hr> or <hr/>(in old tutorials)

Example 3: horizontal line html

<!-- code -->

<hr>

<!-- code -->

Example 4: how to draw a horizontal line in javascript

var elem = document.createElement("hr");
elem.setAttribute("width", "100px");
document.body.appendChild(elem);

Example 5: how to add a horizontal line in html

We can add a horizontal line through the hr tag 
where you will put the hr tag it will create a hr tag 
it doesnt have a closing tag
<hr>

Tags:

Html Example