Div height solution missing in ie6

寵の児 提交于 2019-12-07 10:21:30

问题


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;
}

回答1:


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; }



回答2:


Try:

line-height:0



回答3:


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.




回答4:


try with space in the div or   Just guess



来源:https://stackoverflow.com/questions/1588302/div-height-solution-missing-in-ie6

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!