【发布时间】:2017-10-23 20:59:48
【问题描述】:
我有以下简化的代码笔:https://codepen.io/anon/pen/LzoNNm
基本上,我有这个:
.flex {
display: flex;
flex-direction: row
}
<table>
<thead>
<tr>
<th class="flex" colspan="3">This should stretch</th>
</tr>
<tr>
<th>col 1</th>
<th>col 2</th>
<th>col 3</th>
</tr>
</thead>
</table>
第一个th 没有拉伸到全宽,而是似乎与下一行中的col 1 具有相同的宽度。为什么第一个th 不占全角?
【问题讨论】:
-
我假设将其设置为 display: flex 会导致 colspan 不再被应用(因为 colspan 是特定于表格单元格的,并且您告诉它不要像表格单元格一样工作)。你想实现什么,你可以在单元格内添加一个 flex 吗?
-
既然
colspan已经拉伸th越过th的下一行,你需要display: flex做什么
标签: html css html-table flexbox