我试图在一个
div
中同时放置一个iframe
和img
,但是我的代码会让img
在iframe
的下面。我尝试了使用position
和float
来调整元素的位置,但是都没有奏效。我也查阅了其他Stack Overflow的帖子,但是也没有成功。如果需要的话,我愿意从头开始。
如果有人能够指出我的错误并告诉我如何更正以使其工作,我将不胜感激。我已经查看了其他帖子,但是似乎都不起作用。
谢谢。
@media (min-width: 1200px) {
.container {
max-width: 1080px;
}
}
.hero-unit {
background-color: #000000;
border: 1px solid #252525;
margin-bottom: 30px;
}
.hero-unit img {
display: inline-block;
}
.fp-block {
padding: 5px !important;
padding: 0;
}
/*** CUSTOM CODE FOR YOUTUBE VIDEO DISPLAY ***/
.inner {
float: left;
width: 49%;
margin: 0;
}
.holder {
height: 0px;
width: 100%;
}
<div class="container">
<div class="hero-unit fp-block">
<div id="ut-wrap">
<div class="inner">
<div class="holder">
<iframe src="https://www.youtube.com/embed/_VRXrp_AfMM" frameborder="0" allowfullscreen></iframe>
<img src="http://placehold.it/150x150">
</div>
</div>
</div>
</div>
</div>
media-quary
,它会使它倾斜以适应你的显示器? - ZombieChowderBootstrap
轻松解决了你的问题。你是否同意使用Bootstrap
? - ZombieChowder