0

我正在尝试创建一个将出现在页面中间的弹出框。外框由我们使用的 CMS 定义,并且附加了溢出:隐藏和宽度:250px 样式。我们想要“摆脱外盒”的内盒在我们的控制之下,我们几乎可以做任何我们想做的事情。

不幸的是,我们在 IE 中尝试的一切都不会让弹出窗口从父框的溢出中“逃脱”:隐藏。在我们的例子中,将弹出窗口移到父 div 之外是不可能的。

注意 - 我们测试过的所有其他浏览器都可以按照我们的意愿工作。

这是一个简单的例子。

<html>
<body>
    <div style="width:250px; overflow:hidden; background-color:#dddddd;">
        <p>
            Here is some text that appears within the primary outer box.
        </p>
        <div id='popup2' style="position:absolute; z-index:500; top:0px; left:0px; width:400px; height:200px; background-color:pink;">
            <a href="#" onclick="document.getElementById('popup2').style.display = 'none'; return false;">Close</a><br/>
            This is the popoup. This is the popoup. This is the popoup. This is the popoup. This is the popoup. This is the popoup. This is the popoup. This is the popoup. This is the popoup. This is the popoup.
            This is the popoup. This is the popoup. This is the popoup. This is the popoup. This is the popoup. This is the popoup. This is the popoup. This is the popoup. This is the popoup. This is the popoup.
            This is the popoup. This is the popoup. This is the popoup. This is the popoup. This is the popoup. This is the popoup. This is the popoup. This is the popoup. This is the popoup. This is the popoup.
        </div>
    </div>
</body>
</html>
4

1 回答 1

1

我目前只能在 IE9 中对其进行测试,但是如果您包含严格的文档类型,它可以正常工作:

http://jsfiddle.net/wgWZv/

jsfiddle 使用 html 5

<!DOCTYPE HTML>

我用 4 strict 对其进行了测试,它也可以正常工作。

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
于 2012-04-25T02:51:13.457 回答