我有一个网页,其中有一个 iframe,可以播放各种 YouTube 视频。现在我希望这个 iframe 显示在图像内(该图像基本上是 iPad 图像,我希望 iframe 应嵌入 iPad 图像的屏幕区域内)。有可能实现吗?如果是这样我该怎么做。 任何帮助将不胜感激! 谢谢
最佳答案
将其包裹在div中,使用背景图片
.frame {
width:400px;
height: 400px;
background-size: 100% 100%;
background-repeat: no-repeat;
background-image: url(http://want2scrap.com/store/images/large/Cat%20Frame%20DC_LRG.jpg)
}
.frame iframe {
position: relative;
top: 165px;
left: 100px;
width: 250px;
}
<div class="frame"><iframe src="http://example.com" /></div>
关于javascript - 将 Iframe 嵌入图像内,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27936269/