如果我理解你,你有表格数据,但是你想在浏览器中使用div元素(AFAIK表和带有display:table的表格大致相同)表示。
标记:
first
test
this is long
2nd
more test
it is still long
和CSS:
.theTable{
display:table;
width:95%; /* or whatever width for your table*/
}
.theRow{display:table-row}
.theCell{
display:table-cell;
padding: 0px 2px; /* just some padding, if needed*/
white-space: pre; /* this will avoid line breaks*/
}
.bigCell{
width:100%; /* this will shrink other cells */
}
可悲的是,一年前我无法做到这一点,当时真的需要它-_-!