<div class="container"> <div class="main"></div> <div class="left"></div> <div class="right"></div> </div>
.container { display: flex; } .main { flex: 1; } .left, .right { flex-basis: 200px; } .left { order: -1; } .right { order: 1; }
<div class="main"> <p>这是正文栏</p> </div> <div class="left"> <p>这是左侧栏</p> </div> <div class="right"> <p>这是右侧栏</p> </div>
<div class="container"> <div class="main"></div> </div> <div class="left"></div> <div class="right"></div>
.container { display: flex; } .main { flex: 1; } .left, .right { flex-basis: 200px; } .left { margin-left: -100%; order: -1; } .right { margin-left: -200px; }
<div class="main"> <p>这是正文栏</p> </div> <div class="left"> <p>这是左侧栏</p> </div> <div class="right"> <p>这是右侧栏</p> </div>
本文为翻滚的胖子原创文章,转载无需和我联系,但请注明来自猿教程iskeys.com