开发者

HTML 2x2 table: I want the first row is not divided in two parts

开发者 https://www.devze.com 2023-01-20 10:23 出处:网络
I have an HTML table 2x2. 开发者_StackOverflow社区In that table, I want the first row is not divided in two parts but only has one cell that occupies the full width of the table.

I have an HTML table 2x2.

开发者_StackOverflow社区In that table, I want the first row is not divided in two parts but only has one cell that occupies the full width of the table.

-------
|     |
-------
|  |  |
-------

How can I do that?


Try the colspan attribute.


Use the colspan table cell attribute like this.

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


OK, i should use <th>.


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


Use colspan along with <th> for the header row

  <table>
    <tr>
      <th colspan="2"></th>
    </tr>
    <tr>
      <td></td>
      <td></td>
    </tr>
  </table>
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号