gpt4 book ai didi

html - 带有一个 td(全宽)的 thead 和带有 2 列的 tbody(宽度不取决于 thead)

转载 作者:技术小花猫 更新时间:2023-10-29 12:24:42 28 4
gpt4 key购买 nike

好的,长篇短篇小说。我有一个结构如下的表:

<table>
<thead>
<tr><th>longer Heading with a width of 100%</th></tr>
</thead>
<tbody>
<tr><td>cell 1</td><td>cell 2</tr>
<tr><td>cell 3</td><td>cell 4</tr>
</tbody>
</table>

而且我希望 th 是全宽的并且不改变表格单元格的宽度。我想有一些 CSS 显示属性可以实现这一点,但我还没有找到可行的解决方案。

最佳答案

<table>
<thead>
<tr><th colspan="2">longer Heading with a width of 100%</th></tr>
</thead>
<tbody>
<tr><td>cell 1</td><td>cell 2 </td></tr>
<tr><td>cell 3</td><td>cell 4 </td></tr>
</tbody>

colspan 的使用将为您解决问题

关于html - 带有一个 td(全宽)的 thead 和带有 2 列的 tbody(宽度不取决于 thead),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17907245/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com