IFrame在IE中与div重叠(在Chrome中工作正常)



我写了一些代码,其中div应该与IFrame重叠。在Chrome中它工作正常,而在IE IFrame中重叠div。下面是代码。关于如何解决此问题以使其在IE和Chrome上都能正常工作的任何想法?

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <title>IFrame Div</title>
    </head>
    <body>
        <div top="86px" left="5px" width="500px" height="500px" z-index="20000" style="width: 1000px;
            border-color: red; height: 500px; position: absolute !important; border-color: red;
            left: 5px; top: 86px; border-width: 5px; background-color: #E6E6E6; opacity: .8;">
        </div>
        <iframe src="http://samplepdf.com/sample.pdf" height="700px" width="600px"></iframe>
    </body>
    </html>

给出 iframe: z-index:-999;

或者你可以使用内联CSS:<iframe src="http://samplepdf.com/sample.pdf" height="700px" width="600px" style="z-index:-999;"></iframe>

最新更新