我有一个像下面这样的 html,我希望它像 content-1
的高度一样工作 480px
, content-2
的高度将跟随 content-1
。我的宽度工作正常,但我的高度不符合要求。
如何在CSS中做到这一点?
.container{
clear: both;
}
.content-1{
width:66.66%;
position: static;
background-image: url("../images/path1");
background-repeat: no-repeat;
background-size: cover;
}
.content-2{
width:33.33%;
position: static;
background-image: url("../images/path2");
background-repeat: no-repeat;
background-size: cover;
}
<div class="container">
<div class="content-1"></div>
<div class="content-2"></div>
</div>
原文由 natsumiyu 发布,翻译遵循 CC BY-SA 4.0 许可协议