ie6中缺少Div高度解决方案 [英] Div height solution missing in ie6

查看:81
本文介绍了ie6中缺少Div高度解决方案的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用空白div来显示一条线,方法是设置 height 3px 。它可以在所有浏览器中正常工作,但是在 ie6 中显示高度div <20>高度。即使对于高度:0px也一样。但是其他属性的变化反映了高度,而且没有来自其他div的重复css条目继承值。请问任何人都可以帮忙

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:

CSS:

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


推荐答案

每个元素的内容应该至少有一个字符高。你可以通过使用overflow属性来解决这个问题,这样内容可以保持一个高的字符,但它不会影响元素本身的高度:

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

这篇关于ie6中缺少Div高度解决方案的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆