Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/39.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Css 填表_Css_Html Table_Flexbox - Fatal编程技术网

Css 填表

Css 填表,css,html-table,flexbox,Css,Html Table,Flexbox,是否可以在列上使用(最新的2012年9月)flexbox规范?我有一个宽度是固定的表,还有几个列,其中一些列应该适合单元格内容的宽度,另一些列应该填充表的宽度。我认为必须对以下结构中的进行一些处理 <table> <colgroup> <col></col> // This should shrink/grow to fit the max width of the cell in this column <col>

是否可以在
列上使用(最新的2012年9月)flexbox规范?我有一个
宽度
是固定的表,还有几个列,其中一些列应该适合单元格内容的宽度,另一些列应该填充表的
宽度
。我认为必须对以下结构中的
进行一些处理

<table>
  <colgroup>
    <col></col> // This should shrink/grow to fit the max width of the cell in this column
    <col></col> // Same with this
    <col></col> // This should fill up the width of the table, somewhat like `flex: 1`
  </colgroup>
  <tbody>
    ...
  </tbody>
</table>

//这将缩小/增大以适应此列中单元格的最大宽度
//跟这个一样
//这应该填满表格的宽度,有点像'flex:1'`
...

如果不是,那么是否有解决方法?例如,是否可以使用
flex
,用嵌套的
重建一个表?

为什么要使用table*display properties来重建这个表?@cimmanon只要有可能,这并不重要,但flexbox看起来很简单,我使用flexbox实现了我所有的
,我想把它也应用到表中。使用Flexbox根本不可能做到这一点。您必须更改colgroup的display属性,这将破坏表中col元素的行为,并且在tr/td元素上使用它将是灾难性的,因为单元格将不再对齐。您所能做的最好的事情如下: