2012-07-16 34 views
3

我想放置一个图像在我的iframe下,但我拼凑了一些代码,它看起来并不完全正确。 iframe包含文本并具有透明背景。你能帮我吗?谢谢,如何在图片上放置iframe?

<td width="216" style="position: relative;"> 
<img src="http://southwestarkansasradio.com/images/onair995.jpg"></a><br> 
<img src="http://southwestarkansasradio.com/images/playerbackground.jpg" style="z-index: -1"/> 
<div style="absolute;left:0px;top:0px;font-size: 32px;display: none"> 
    <iframe name="I1" width="316" height="216" src="http://southwestarkansasradio.com /NowPlaying.html" border="0" frameborder="0" allowTransparency="true"> 
Your browser does not support inline frames.</iframe> 

</div> 
</td> 
+0

使用单独的CSS文件移动所有对象。从长远来看,这将容易得多。 – 2012-07-16 16:19:55

回答

2
<img src="http://southwestarkansasradio.com/images/onair995.jpg"></a><br> 
<img src="http://southwestarkansasradio.com/images/playerbackground.jpg" style="z-index: -1"/> 
<div style="position:absolute;left:0px;top:0px;font-size: 32px"> 
    <iframe width="316" height="216" src="http://southwestarkansasradio.com/NowPlaying.html" border="0" frameborder="0" allowTransparency="true"> 
     Your browser does not support inline frames.</iframe> 
</div> 

您有:在包含iframe的div标签 '显示无'。我测试了上面的代码,它的工作原理就像你已经解释过的那样。

+0

如果您想将iframe向下移动一下以适应图片而不是横幅,只需添加'margin-top:40px;'或者图片将iframe向下移动的像素数量。将此添加到包含iframe的div标签的style属性中。 – 2012-07-16 16:25:15

+0

谢谢,我认为这个问题也是缺失的“立场:”......现在要对齐它。 – user1330148 2012-07-16 16:26:32

+0

非常感谢! – user1330148 2012-07-16 16:28:04