IE6 bug,CSS,绝对位置和高度 100% 内部 DIV
我正在做网站,那里有 3 个 DIV,
<div id="inner">
<div id="content" >
<div id="scroll" >
</div>
</div>
</div>
现在,div“内部”是宽度和高度 - 自动,绝对位置; “内容”宽度:100%;高度:100%; '滚动'宽度为:96%;填充量:2%;身高:96%;溢出:自动;
html, body {width:100%; height:100%; margin:0; padding:0; border:0 none;}
#scroll
{
width: 96%;
padding:2%;
height: 96%;
overflow: auto;
}
#content {
width:100%;
height:100%;
overflow:hidden;
line-height:18px;
}
#inner {
position:absolute;
background:none;
width:auto;
height:auto;
top:40px;
bottom:85px;
right:10px;
left:300px;
}
在 Firefox、Opera IE8<一切正常,但在 IE6 和 IE7 中 div 'scroll' 太长,height:100% 不起作用。 你可以在图片上看到它:
有人有想法吗?请帮我 :)
I'm doing website and there I have 3 DIVs,
<div id="inner">
<div id="content" >
<div id="scroll" >
</div>
</div>
</div>
And now, div 'inner' is width and height - auto, position absolute;
'Content' have width:100%; height:100%;
And 'Scroll' is width: 96%; padding:2%; height: 96%; overflow: auto;
html, body {width:100%; height:100%; margin:0; padding:0; border:0 none;}
#scroll
{
width: 96%;
padding:2%;
height: 96%;
overflow: auto;
}
#content {
width:100%;
height:100%;
overflow:hidden;
line-height:18px;
}
#inner {
position:absolute;
background:none;
width:auto;
height:auto;
top:40px;
bottom:85px;
right:10px;
left:300px;
}
In Firefox, Opera IE8< everything is OK, but in IE6 and IE7 div 'scroll' is too long, height:100% doesn't work. You can see it on the picture:
Anybody have a idea ? Please help me :)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
![扫码二维码加入Web技术交流群](/public/img/jiaqun_03.jpg)
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
IE7也有这个bug。
我能找到的唯一解决方法是将
#content-element
也设置为position:absolute
。IE7 has this bug too.
The only workaround i could found is, set the
#content-element
also toposition:absolute
.对于 IE 中的 100% 高度,您需要将其添加到 CSS 中。
for 100% height in IE you need to add this to your CSS.
我不太确定,但我认为也许使用“继承”作为高度属性可以解决问题。
I'm not really sure, but I think maybe using "inherit" for height property solves the problem.