Html html表格单元格组合
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/4477927/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
html table cells combine
提问by Alex Pliutau
I have a table with 3 rows and 3 columns. How can combine last row columns? My html:
我有一个 3 行 3 列的表格。如何组合最后一行列?我的html:
<table>
<tr><td></td><td></td><td></td></tr>
<tr><td></td><td></td><td></td></tr>
<tr><td>Here I need a cell by all width</td></tr>
</table>
回答by Oded
回答by Alin Purcaru
For this exact purpose the colspan
attribute was created.
正是出于这个目的,colspan
创建了该属性。
<table>
<tr><td></td><td></td><td></td></tr>
<tr><td></td><td></td><td></td></tr>
<tr><td colspan="3">Here I need a cell by all width</td></tr>
</table>
Similarly you can use use the rowspan
attribute if you want to span multiple rows.
同样,rowspan
如果您想跨越多行,您可以使用该属性。
<table>
<tr><td></td><td></td><td rowspan="3">Spans full table height</td></tr>
<tr><td></td><td></td></tr>
<tr><td></td><td></td></tr>
</table>
To learn more about these two attributes visit the official documentation on w3.org.
要了解有关这两个属性的更多信息,请访问w3.org 上的官方文档。
Also I urge you not to use tables unless you need to present tabular data.
此外,我敦促您不要使用表格,除非您需要提供表格数据。