<style type="text/css">
#b{
    display:-moz-box;
    -moz-box-orient:horizontal;
    display:-webkit-box;
    display:box;
    box-orient:horizontal;

    border: 1px solid black;
}
#box1{
    background:orange;
    -moz-box-flex: 2;
     -webkit-box-flex: 2;
     box-flex: 2;
}
#box2{
    background:green;
    -moz-box-flex: 1;
     -webkit-box-flex: 1;
     box-flex: 1;
}
#box3{
    background:pink;
    -moz-box-flex: 2;
     -webkit-box-flex: 2;
     box-flex: 2;
}
</style>
<div >
  <div >1</div>
  <div >2</div>
  <div >3</div>
</div>

这段代码将父元素以2:1:2的宽度分给子元素,运行结果如下

子元素按比例横向分布——css3弹性盒子模型

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-05-30
  • 2021-12-14
  • 2022-01-16
猜你喜欢
  • 2021-05-10
  • 2022-01-19
  • 2021-05-20
  • 2022-12-23
  • 2021-07-07
  • 2021-04-19
  • 2021-12-22
相关资源
相似解决方案