1

我刚刚弄清楚了colspan属性。我可以这样做:

┌-----------------------------------------------┐
|       |          |                     |      |
|-------+----------+----------+----------+------|
|       |          |          |          |      |     
|-------+----------+---------------------+------|
|       |          |          |          |      |
|-------+----------+---------------------+------|
|       |          |          |          |      |
└-----------------------------------------------┘

但我真正想做的是这样的:

┌-----------------------------------------------┐
|       |          |                     |      |
|-------+----------+----------+----------+------|
|       |          |          |          |      |     
|-------+----------+---------------------+------|
|       |          |          |          |      |
|-------+----------+----------+----------+------|
|                  |                     |      |
└-----------------------------------------------┘
4

3 回答 3

0

例子

<table border="1">
    <tr>
        <th></th>
        <th></th>
        <th colspan="2"></th>
        <th></th>
    </tr>
    <tr>
        <td></td>
        <td></td>
        <td></td>
        <td></td>
        <td></td>
    </tr>
    <tr>
        <td colspan="2"></td>
        <td colspan="2"></td>
        <td></td>
    </tr>
</table>
于 2013-08-14T01:12:45.450 回答
0

演示:http: //jsfiddle.net/FksE4/1/

<table border="1">
    <tr>
        <td>1</td>
        <td>2</td>
        <td colspan="2">3</td>
        <td>5</td>
    </tr>
    <tr>
        <td>1</td>
        <td>2</td>
        <td>3</td>
        <td>4</td>
        <td>5</td>
    </tr>
    <tr>
        <td>1</td>
        <td>2</td>
        <td>3</td>
        <td>4</td>
        <td>5</td>
    </tr>
    <tr>
        <td colspan="2">1</td>
        <td colspan="2">3</td>
        <td>5</td>
    </tr>
</table>
于 2013-08-14T01:06:48.253 回答
0

colspan可以在任何单元格中工作tdth您只需正确计算它们,例如

<table>
  <tbody>
    <tr>
      <td></td>
      <td></td>
      <td colspan="2"></td>
      <td></td>
    </tr>
    <tr>
      <td></td>
      <td></td>
      <td></td>
      <td></td>
      <td></td>
    </tr>
    <tr>
      <td></td>
      <td></td>
      <td></td>
      <td></td>
      <td></td>
    </tr>
    <tr>
      <td colspan="2"></td>
      <td colspan="2"></td>
      <td></td>
    </tr>
  </tbody>
</table>

这将为您提供您描述的表格。

于 2013-08-14T01:08:19.590 回答