【发布时间】:2022-01-27 08:31:02
【问题描述】:
编辑:解决方案必须有display: inline-block;
我正在尝试将 iframe 放在图像上。但是,无论我将 margin-right 设置为什么,它都保持在同一个位置。大约是背景图片的 1/5。
HTML
<div class="backgroundimage">
<img src="http://truespeed.ca/wp-content/uploads/2016/06/tvscreen.png" alt="null" />
<iframe class="Youtube" width="479" height="269" src="https://www.youtube.com/embed/6ydYvG52K-E" frameborder="0" allowfullscreen></iframe>
</div>
CSS
.backgroundimage {
display: inline-block;
position: relative;
top: 70px;
bottom: 46px;
}
.Youtube {
position: absolute;
left: 280px;
bottom: 46px;
right: 380px;
}
还有我的问题的图片:
【问题讨论】:
-
在容器上设置
top和left有什么原因吗?