月关宝盒
据我所知,css中没有colspan,但column-span在不久的将来会有多列布局,但由于它只是CSS3中的草稿,你可以在这里查看。无论如何,你可以使用div和span像这样的表格式显示做一个解决方法。这将是HTML:
for the sake of table-less layout. */
.table { display:table; table-layout:fixed; width:100px; }
.row { display:table-row; height:10px; }
.cell { display:table-cell; }
/* this is where the colspan tricks works. */
span { width:100%; }
/* below is for visual recognition test purposes only. */
.red { background:red; }
.blue { background:blue; }
.green { background:green; }
.black { background:black; }
/* this is the benefit of using table display, it is able
to set the width of it's child object to fill the rest of
the parent width as in table */
.first { width: 20px; }
.last { width: 30px; }
.fill { width: 100%; }使用这个技巧的唯一原因是为了获得table-layout行为的好处,如果仅将div和span宽度设置为某个百分比并未满足我们的设计要求,我会使用它。但如果你不需要从这种table-layout行为中受益,那么durilai的回答就足够了。