HTML <td> colspan 属性
标签" href="tag-main.html"><main>
<map>
<mark>
<menu>
<meta>
<meter>
<nav>
<noframes>
<noscript>
<object>
<ol>
<optgroup>
<option>
<output>
<p>
<param>
<pre>
<html>
<picture>
<progress>
<q>
<rp>
<rt>
<ruby>
<s>
<samp>
<script>
<section>
<select>
<small>
<source>
<span>
<strike>
<strong>
<style>
<sub>
<summary>
<sup>
<table>
<tbody>
<td>
<textarea>
< template>
<tfoot>
<th>
<thead>
<time>
<title>
<tr>
<track>
<tt>
<u>
<ul>
<var>
<video>
<wbr>
HTML <td> colspan 属性
实例
下面的 HTML 表格中包含一个横跨两列的表格单元格:
<table border="1">
<tr>
<th>Month</th>
<th>Savings</th>
</tr>
<tr>
<td>January</td>
<td>$100</td>
</tr>
<tr>
<td>February</td>
<td>$100</td>
</tr>
<tr>
<td colspan="2">Sum: $180</td>
</tr>
</table>
<tr>
<th>Month</th>
<th>Savings</th>
</tr>
<tr>
<td>January</td>
<td>$100</td>
</tr>
<tr>
<td>February</td>
<td>$100</td>
</tr>
<tr>
<td colspan="2">Sum: $180</td>
</tr>
</table>
浏览器支持
所有主流浏览器都支持 colspan 属性。
注意:只有 Firefox 支持 colspan="0",该值有特殊的含义(请看下面的"属性值"表格)。
定义和用法
colspan 属性定义单元格应该横跨的列数。
HTML 4.01 与 HTML5之间的差异
无。
语法
<td colspan="number">
属性值
| 值 | 描述 |
|---|---|
| number | 规定单元格应该横跨的列数。注意: colspan="0" 告知浏览器使单元格横跨到列组 (colgroup) 的最后一列。 |
HTML <td> 标签