style{ .box{ width:100px; height:100px; position: absolute; top: 50%; left: 50%; margin:-50px; } } <div class="box"></div>
<div class="container"> <div class="item"></div> </div>
.container { display:flex; } .item { margin:auto; }
.father{ width:600px; height:800px; border: 1px solid #fff; display:flex; } .son{ width:200px; height:400px; background-color:#fff; margin:auto; }
这道题你会答吗?花几分钟告诉大家答案吧!
扫描二维码,关注牛客网
下载牛客APP,随时随地刷题