其实很简单,看下面实例:
1、页面布局要求一个大盒子包着两个小盒子。
2、outbox设置成伸缩盒子。
3、box1的盒子设置一定的宽度。
4、box2设置flex:1 表示占剩余的所有部分。
<style> .outbox{ display:flex; } .box1{ 100px; } .box2{ flex:1;//表示所有剩余部分 } </style> <div class="outbox"> <div class="box1"></div> <div class="box2"></div> </div>