javascripthtmlcsstagsvisual-web-developer-2010

How to make a horizontal line without using <hr> tag?


How can I draw a thin horizontal line without using the <hr> tag ?

I tried this:

.horizontal-line{
  border-top: 1px solid #9E9E9E;
  border-bottom: 1px solid #9E9E9E;
}

Although it works, I want this line to be thinner. I tried to reduce 1px to 0.5px, but it didn't work.


Solution

  • You can use it but there is not much difference.

    .line {
      display: inline-block;
      width: 100%;
      border-top: 0.2px solid red;
    }
    
    hr {
      border-top: 0.2px solid red;
    }
    <div>
      content
    </div>
    <span class='line'></span>
    <div>
      content
    </div>
    <hr>
    <div>
      content
    </div>