Div height solution missing in ie6

2019-05-07 10:39发布

i'm using a empty div to display a line by setting height 3px. it works fine in all browsers but in ie6 the height div displayed with 20px height. It remains same even for height:0px . But changes in other properties reflects but not height and there is no duplicate css entry and inherited value from other div. Can any one help please

<div id="line"></div>   

CSS:

#line {
    border: none;
    background-color: #134c7c;
    height: 3px;
    margin-bottom: 20px;
}

标签: css html height
4条回答
Melony?
2楼-- · 2019-05-07 11:17

Just a wild guess.

Inspect whether there is any space inside the element. If yes then set the

font-size: 1px;

property of the element.

查看更多
Anthone
3楼-- · 2019-05-07 11:19

Try:

line-height:0
查看更多
地球回转人心会变
4楼-- · 2019-05-07 11:24

Internet Explorer has the odd idea that the content of every element should be at least one character high. You can get around this by using the overflow attribute, that way the content can remain a character high, but it doesn't affect the height of the element itself:

.line { height: 3px; overflow: hidden; }
查看更多
成全新的幸福
5楼-- · 2019-05-07 11:29

try with space in the div or   Just guess

查看更多
登录 后发表回答