5

It's just a standard HTML 'hr' tag but the line is displaying with an odd extra pixel. My only CSS is:

hr {margin:0%;line-height: 100%;}

Apparently I don't have enough rep to include images of the issue, so you'll have to go off my description.

l0adopt1c
  • 57
  • 1
  • 9

5 Answers5

6

Use the height property instead of the line-height property and that should fix your issue. Here's some additional information on styling hr tags. Cross-Browser hr Styling

It's in the comments now, but here's the fix that worked for him. hr { border:none; border-top:1px #CCCCCC solid; height: 1px; }

JR Smith
  • 1,186
  • 15
  • 20
  • Yes, I tried it in Firefox and nothing was wrong. However, I need this to work in Chrome and for the life of me I cannot figure out what's wrong with it. – l0adopt1c Apr 16 '13 at 14:00
  • Try using this fix, should work across browsers. hr { border:none; border-top:1px #CCCCCC solid; height: 1px; } – JR Smith Apr 16 '13 at 14:05
4

The HR uses a shadow on it in most browsers. You should override the style using css or something like:

<hr noshade size="1" />

Update: noshade is deprecated... See http://www.electrictoolbox.com/style-html-hr-tag-css/

ferdyh
  • 1,355
  • 2
  • 11
  • 29
2

Css Solution:

hr {
    border: none;
    background-color: #000;
    color: #000;
    height: 1px;
}
S.Visser
  • 4,645
  • 1
  • 22
  • 43
1

Cross-browser solution with CSS:

hr { height: 1px; background-color: #000; border: 0 none; }

How I change the thickness of my <hr> tag

jsFiddle:

http://jsfiddle.net/6nXaN/

Community
  • 1
  • 1
Alex W
  • 37,233
  • 13
  • 109
  • 109
1

An hr tag is just rendered as a 1px tall empty element with a border style of inset (change the height of the hr a few pixels to see what I mean). The extra pixel comes on the left due the way the inset border is rendered. If you add:

hr { border-left: none; }

...then you can maintain the inset look of the default hr without the extra pixel. Making the border-style solid, or making it a black background colour may make your hr too dark. I prefer the subtlety of the above approach.

Tim
  • 11
  • 1