3 回答
TA贡献1801条经验 获得超15个赞
您可以将flexbox用于此布局。
.left {
background: blue;
flex: 1 1 60%;
}
.right {
background: green;
flex: 1 1 30%;
}
.container {
display: flex;
color: white;
}
<div class="container">
<div class="left">
<div>hello</div>
<div>hello</div>
<div>hello</div>
<div>hello</div>
</div>
<div class="right">
RIGHT
</div>
</div>
您可以为此布局使用网格。
.left {
background: blue;
}
.right {
background: green;
}
.container {
display: grid;
grid-template-columns: 2fr 1fr;
color: white;
}
<div class="container">
<div class="left">
<div>hello</div>
<div>hello</div>
<div>hello</div>
<div>hello</div>
</div>
<div class="right">
RIGHT
</div>
</div>
TA贡献1831条经验 获得超4个赞
All is left: 对齐要定位在顶部的元素vertical-align
div.left {
background: blue;
height: 200px;
width: 60%;
}
div.right {
background: green;
height: 200px;
width: 30%;
}
.container div {
display: inline-block;
vertical-align: top;
}
.left div {
display: block;
}
<div class="container">
<div class="left">
<div>hello</div>
<div>hello</div>
<div>hello</div>
<div>hello</div>
</div>
<div class="right">
RIGHT
</div>
</div>
添加回答
举报