How can I create a horizontal line with <span> or <div>, instead of <hr>?

Issue

I would like to know how I can make the tag <hr> effect with the tag <span> or <div>.

I see in large websites the horizontal lines, but they do not use the <hr> tag.

<!DOCTYPE html>
<html lang="pt-Br">
  <head>
    <title> H - Line </title>
   </head>
 <body>
    <hr/>
 </body>
</html>

.

Solution

you can use any other HTML tag, define it as follows:

span{
   display:block;
   width:100% /*or whatever width you want the effect of <hr>*/
   border-top: 1px solid #ccc
}

Note you could use border-bottom or border-top and make it any color you want (#ccc resembles the hairline tag pretty well)

Good luck!

Answered By – CreMedian

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published