iframe上的Z-index iframe

时间:2016-06-30 16:15:16

标签: javascript html iframe

这可能吗?我已经尝试在我要重叠的那个上设置z-index: 999;,但后来却没有运气。

基本上我想在#cgdiv

上重叠#cDiv

风格:

            #cgDiv {
                z-index:999;
                display: inline-block;
                height: 100%;
                vertical-align: top;
                width: 30%;
            }

            #contentGenerator, #content {
                height: 100%;
                width: 100%;
            }

            #cDiv {
                z-index:998;
                display: inline-block;
                height: 100%;
                vertical-align: top;
                width: 69.5%;
            }

            body { margin: 0}

HTML

            <HTML>
            <HEAD>


            </HEAD>
            <BODY >
            <DIV id="cgDiv">
                <IFRAME id="contentGenerator" src="content.html">
                </IFRAME>
            </DIV>
            <DIV id="cDiv">
                <IFRAME id="content" src="startNSM.html">
                </IFRAME>
            </DIV>
            </BODY>
            </HTML>

1 个答案:

答案 0 :(得分:0)

是肯定的。您可以将position:absolutetop:0设置为重叠

position: absolute;
top: 0;

看到这个小提琴示例

https://jsfiddle.net/qvct1tnm/2/