简体   繁体   English

兼容模式DIV中的IE7 / IE8出现溢出问题

[英]IE7/IE8 in Compatibility mode DIV with overflow problem

I have a scrollable div on a page that ends up rendering past the bottom of div and sometimes leaves stick characters behind that don't scroll. 我在页面上有一个可滚动的div,该div最终呈现超出div底部的位置,有时在其后面留下不滚动的棍子字符。 This happens in IE7 and IE8 in compatibility mode. 在兼容模式下的IE7和IE8中会发生这种情况。

Here is the HTML code from the DOM: 以下是DOM中的HTML代码:

<DIV id=ctl00_MainContent_ViewPort class=AgreementViewPort><IMG class=PortSeal src="/images/Seal.png">
<DIV class=DocumentTitle>Document Title</DIV>
<OL>
<LI>Condition #1</LI>
<LI>Condition #2<SUP>1</SUP></LI>
<LI>Condition #3</LI>
<DL>
<DT><SUP>1</SUP> some foot-noted definition.</DT></DL></DIV>

Here's the applied CSS style: 这是应用的CSS样式:

color: #000;
font-family: arial, tahoma, sans-serif
font-size: 12pt;
height: 300px;
margin: 5px;
overflow: scroll;
padding : 5px;
width: 600px;

This renders fine under IE8, Firefox, and Chrome. 在IE8,Firefox和Chrome下,此效果很好。

Any suggestions? 有什么建议么?

Just by looking I'd suggest putting the image in its own DIV. 只是看一下,我建议将图像放入自己的DIV中。 This way you can control any overflows. 这样,您可以控制任何溢出。

Also add the following to your CSS: 还将以下内容添加到您的CSS中:


clip:rect(0px,600px,300px,0px);

We've solved the mystery. 我们解决了这个谜。

If you want to poke at the issue directly, here's where it can be seen live . 如果您想直接查看问题,可以在此处实时查看。 Note: After we push the fix, this link won't repro. 注意:推送修复后,此链接将不会复制。

On the LI element in the page level CSS, I removed the following style attributes 在页面级CSS的LI元素上,我删除了以下样式属性

li
{
        margin-bottom: 10px;
        position: relative;
        left: 10px;
        width: 500px;
}

And replaced them with: 并将它们替换为:

li
{
    margin: 0px 0px 10px 25px;
}

On the OL element in the page level CSS, the width attribute was moved. 在页面级CSS的OL元素上,width属性已移动。

ol 
    {
        padding-left: 10px;
        width: 500px;
    }

And I feel like something of an idiot. 而且我觉得自己是个白痴。 The moral of the story, and this has been discussed elsewhere is that IE7 scrollable divs and the CSS position attribute do not play well together. 这个故事的寓意在于,IE7的可滚动div和CSS position属性不能很好地结合在一起使用,这在其他地方已经讨论过了。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM