【发布时间】:2017-09-04 13:30:53
【问题描述】:
我想将 2 个 div 内联。第一个 div 是从 youtube 嵌入的视频。第二个 div 带有一些文本。我尝试使用浮动和清除,但是当我使用它时,视频消失了。我尝试使用 display: inline-block 但我收到了相同的结果。我用clear:both 在底部尝试了一个空的div,结果并不满意。我真的很想知道问题出在哪里?视频容器是响应式的。也许这会导致问题?下面我附上一段代码。
.desc {
border-left: 4px solid #80d4ff;
padding: 6px 10px 8px 6px;
text-indent: 5px;
background-color: #fff;
}
.video-container {
position: relative;
padding-bottom: 56.25%;
overflow: hidden;
margin: 15px 0;
}
.video-container iframe,
.video-container object,
.video-container embed {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
.videoHndl {
max-width: 500px;
margin: 0;
padding: 0;
overflow: hidden;
}
<div class="videoHndl">
<div class="video-container">
<iframe width="500px" height="280" src="https://www.youtube.com/embed/HRbD4UcK-0I">
</iframe>
</div>
<div class="desc">
<p><b>Description:</b></p>
<p>Some text Some text Some text Some text Some text Some text Some text Some text Some text Some text Some text Some text Some text Some text Some text Some text </p>
</div>
</div>
【问题讨论】: