use*_*580 11 html css iframe internet-explorer
我想要实现的是iframe定位在包含PDF文档的另一个iframe上 - 第一个iframe应该是透明的,它应该覆盖带有PDF的iframe.我需要专门用于IE(9+).
到目前为止我尝试过的代码:
<html>
<head>
<style>
</style>
</head>
<body>
<iframe src="iframeContent.html" frameborder="0" style="width: 1000px; height: 1000px; position: fixed; left:0px; top: 0px; background:transparent" allowTransparency="true"></iframe>
<iframe src='http://www.pdf995.com/samples/pdf.pdf' width="100%" height="300px" id="PDF" name="PDF"></iframe>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
iframeContent.html:
<html>
<style type="text/css">
</style>
<body style="background: transparent">
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
但是,上述方法不起作用 - iframe不透明.有谁知道如何解决这个问题?正如我在下面的评论中所说,下面发布的解决方案不适用于安装Adobe Reader DC(如果它可以工作).
Try setting setting opacity: 0 on the outer iframe.
Using your modified code,
<iframe src="iframeContent.html" frameborder="0" style="opacity: 0; z-index: 2; width: 1000px; height: 1000px; position: fixed; left:0px; top: 0px; background:transparent" allowTransparency="true"></iframe>
<iframe src='http://www.pdf995.com/samples/pdf.pdf' width="100%" height="300px" id="PDF" name="PDF"></iframe>
Run Code Online (Sandbox Code Playgroud)
You can also use z-index to manage stacking of elements. All elements default z-indez is 1. THose with higher values will appear on top of elements with a lower z-index.