我想在我的网页上的iframe中显示图片.但是,问题在于我无法将其扩展到100%的大小.
我想做的是以下内容.
目前,这是我的代码:
echo"<iframe name='graph' id='graph' src=$image style='position:absolute; top:0px; left:0px; height:100%;width:100%'></iframe>";
Run Code Online (Sandbox Code Playgroud)
这样做,它使iframe成为我的网页的顶部,仍然没有扩大到100%.如果我删除位置:绝对:
echo"<iframe name='graph' id='graph' src=$image style='top:0px; left:0px; height:100%;width:100%'></iframe>";
Run Code Online (Sandbox Code Playgroud)
我最终将它的宽度扩展到100%,但就高度而言,它只有3个像素高,并且有一个滚动条滚动到底部.
我搜索网络寻找修复,但我没有尝试过任何工作.有人提到改变CSS,但无济于事......
编辑
我面临的另一个问题是图像在Firefox中被缩小.我需要点击iframe中的图片将其展开到完整尺寸.它虽然在Chrome和IE中正确显示.有没有解决这个问题?
小智 6
使用下面的代码来显示图像.
<iframe frameborder="0" scrolling="no" width="100%" height="100%"
src="../images/eightball.gif" name="imgbox" id="imgbox">
<p>iframes are not supported by your browser.</p>
</iframe><br />
<a href="../images/redball.gif" target="imgbox">Red Ball</a><br />
<a href="../images/floatingball.gif" target="imgbox">Floating Ball</a><br />
<a href="../images/eightball.gif" target="imgbox">Eight Ball</a>
Run Code Online (Sandbox Code Playgroud)