Overlay Image above Embedded pdf

2020-07-22 16:56发布

问题:

I am attempting to overlay an image above a pdf embedded in and iFrame.

This code results in the image falling behind the iFrame (tested by changing the bottom attribute to -10px and the bottom of the image becomes visable)

The only two methods I was aware of were using z-index, and the fact position absolute should place the object on top, but neither appear to be working.

<div id="images" style="float:right;position:relative" width="400" height="250">
    <img src="images/Next_Black_Arrow.png" style="height:25px;width25px;float: left;z-index=10;position:absolute;bottom:10px;left:250px;">
    <iframe SRC="testFiles/Categories of pattern matching characters.pdf#toolbar=0&navpanes=0&scrollbar=0" style="z-index=1;position:relative;"  width="400" height="250"></iframe>
    </div>

*Applogies for the lack of separated css


While that works, unfortunately it doesn't if you change the iframe link to a pdf.

See http://jsfiddle.net/vr4rX/4/

I think it must be a bug in the adobe reader. Could really do with a work around.

回答1:

have a look at my solution: http://jsfiddle.net/vr4rX/1/

HTML:

<div id="images">
    <img src="http://t1.ftcdn.net/jpg/00/02/78/72/400_F_2787285_mlDf8ah974XHflVFrbQB3FM6Qxu1MT.jpg" />
    <iframe SRC="http://www.google.de"  width="400" height="250"></iframe>
</div>

CSS:

#images {
    float:right;
    width: 400px;
    height: 250px;
    position: relative;
    z-index: 1;
}

#images img {
   height:25px;
    width:25px;
    z-index=2;
    position:absolute;
    bottom:20px;
    right:20px;
}