2 回答

TA貢獻(xiàn)1802條經(jīng)驗(yàn) 獲得超10個(gè)贊
您必須將position-absolute類添加到最后一列及position-relative其父級(jí)row
.col:first-of-type {
background: red
}
.col:last-of-type {
border: green solid
}
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" rel="stylesheet" />
<div class="container">
<div class="row position-relative">
<div class="col"> box1 </div>
<div class="col position-absolute"> box2 </div>
</div>
</div>

TA貢獻(xiàn)2080條經(jīng)驗(yàn) 獲得超4個(gè)贊
<div class="container">
<div class="row position-relative">
<div class="col-md-4 box1"> box1 </div>
<div class="col-md-4 box2 position-absolute"> box2 </div>
</div>
</div>
.box1 {
width: 100%;
height: 100px;
background: red;
border-radius: 25px;
text-align: center;
}
.box2 {
width: 100%;
height: 100px;
background: green;
border-radius: 25px;
top: 10px;
text-align: center;
left: 3px;
}
- 2 回答
- 0 關(guān)注
- 219 瀏覽
添加回答
舉報(bào)