tags:

views:

61

answers:

5

Hi,

i have an HTML table 2x2.

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?

Regards

Javi

+5  A: 

Try the colspan attribute.

Frédéric Hamidi
+1  A: 
<table>
 <tr>
   <td colspan = 2></td>
 </tr>
 <tr>
   <td></td>
   <td></td>
 </tr>
</table>
Loïc Février
Invalid closing tags for `<tr>`.
sshow
It's now fixed.
Loïc Février
A: 

OK, i should use <th>.

+2  A: 

Use the colspan table cell attribute like this.

<table>
 <tr>
   <th colspan="2"></th>
 </tr>
 <tr>
   <td></td>
   <td></td>
 </tr>
</table>
James
Shouldn't have the second `td` element in the first row.
Chris Farmer
Fixed - Thanks for pointing that out.
James
A: 

Use colspan along with <th> for the header row

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