本文介绍了IE7 CSS滚动Div Bug的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近遇到一个IE7的错误,我以为我会分享,所以当我从现在6个月来到这个网站找出同样的事情,我会有它的手。

I recently came across an IE7 only bug that I thought I'd share so when I come to this site 6 months from now to figure out the same thing, I'll have it on hand.

我相信最容易的方法来重建这个错误将是一个声明的doctype页面中的以下html(它在quirks模式/ no-doctype中正确工作) :

I believe the easiest way to recreate this bug would be the following html in a page with a declared doctype (it works correctly in "quirks mode" / no-doctype):

<div style="overflow: auto; height: 150px;">
    <div style="position: relative;">[...]</div>
</div>

在IE7中,外部div是固定大小,内部div相对定位, (假设内部div导致溢出)。在所有其他浏览器中,这看起来像预期的那样工作。

In IE7, the outer div is a fixed size and the inner div is relatively positioned and contains more content (assuming the inner div causes an overflow). In all other browsers, this seems to work as expected.

屏幕截图:

Screenshot:

推荐答案

最简单的解决方法是添加 position :relative; 到外部div。这将使IE7按预期工作。

The easiest fix would be to add position: relative; to the outer div. This will make IE7 work as intended.

(请参阅:)。

EDIT:

这篇关于IE7 CSS滚动Div Bug的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-02 12:39