IE6 bug,CSS,绝对位置和高度 100% 内部 DIV

发布于 2024-10-18 06:31:36 字数 893 浏览 6 评论 0原文

我正在做网站,那里有 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技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

蝶舞 2024-10-25 06:31:36

IE7也有这个bug。

我能找到的唯一解决方法是将 #content-element 也设置为 position:absolute

IE7 has this bug too.

The only workaround i could found is, set the #content-element also to position:absolute.

白龙吟 2024-10-25 06:31:36

对于 IE 中的 100% 高度,您需要将其添加到 CSS 中。

* html #content{
height:100%;
}

for 100% height in IE you need to add this to your CSS.

* html #content{
height:100%;
}
川水往事 2024-10-25 06:31:36

我不太确定,但我认为也许使用“继承”作为高度属性可以解决问题。

I'm not really sure, but I think maybe using "inherit" for height property solves the problem.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文