【发布时间】:2014-02-19 00:45:58
【问题描述】:
我在 div 中有一个 div,我希望内部 div 包含背景颜色或背景图像。我的代码是:
<div class="row two">
<div class="cols n15">
<h2 class="latestVideo">Latest Video</h2>
<iframe width="100%" height="370" src="//www.youtube.com/embed/a-XQL60NVmQ" frameborder="0" allowfullscreen></iframe>
</div>
<div class="cols n9 clearfix">
<h2>Other Videos</h2>
<div class="otherVids">
<p>"test"<p>
<!-- <img src="images/otherVideos.jpg" alt=""> -->
<div class="video1">
</div>
<div class="vidoe2">
</div>
<div class="video3">
</div>
</div>
<div style="clear:both"></div>
现在它看起来像这样:
我想要的是红色框一直向下延伸并匹配左侧 div 的高度。我意识到如果我有 div(otherVids) 的高度和宽度,这会起作用,但如果我这样做,网站将不再响应。
那么是否有办法让 div 背景填充空白空间同时仍保持响应?
这是我的 CSS 代码:
.otherVids{
background-image: url('images/otherVideos.jpg');
background-color: red;
width: 100%;
height: 100%;
}
【问题讨论】:
标签: html css responsive-design