Heim  >  Fragen und Antworten  >  Hauptteil

css3 - 为什么使用css box布局时需要写width?

比如如下代码:

css    .box {
       display:-webkit-box;
     }
    .item {
         -webkit-box-flex: 1;
         width:1%; //this value can be set to any value 
    }

为什么需要给这个item设置宽度?我要的是等分布局啊


这个问题的提出其实是项目中的一个页面,DEMO地址如下:

http://codepen.io/anon/pen/EjMvZB

我设置成width:1%,其中第一行的第一个不会和第二行的第二个对其,但是我把width设为0.00001%,那段距离神器的填补了?这个width到底起的是什么作用?

阿神阿神2713 Tage vor447

Antworte allen(0)Ich werde antworten

Keine Antwort
  • StornierenAntwort