search

Home  >  Q&A  >  body text

css3 - 关于display: -webkit-box;下的-webkit-box-flex: 1。实际效果宽度并不是1:1

如下代码
http://jsbin.com/cavusimoto/edit?html,css,output

简单的一行两列,用的-webkit-box-flex: 1
那么2列的宽度应该都是50%,可是实际情况是,文字多的那一列,宽度会更多一点。为什么呢?

迷茫迷茫2778 days ago630

reply all(2)I'll reply

  • 怪我咯

    怪我咯2017-04-17 11:28:34

    Just add width: 0;, those who add -webkit-box-flex: 1;

    reply
    0
  • 伊谢尔伦

    伊谢尔伦2017-04-17 11:28:34

    -webkit-box-flex: 1 means that the ratio of allocating the remaining width of the parent container is 1:1, not the total width of the parent container. If you write more content on the second sub-element, the effect will be obvious:

    <p class="bb">1122234411222344112223441122234411222344</p>

    reply
    0
  • Cancelreply