2012-01-25 10 views

Respuesta

40

<th colspan="2">. This .</th>

Para extrapolar un poco ...

<table> 
    <thead> 
    <tr> 
     <th>Single Column</th> 
     <th colspan="2">Double Column</th> 
    </tr> 
    </thead> 
    <tbody> 
    <tr> 
     <td>Column One</td> 
     <td>Column Two</td> 
     <td>Column Three</td> 
    </tr> 
    </tbody> 
</table> 

que debe darle suficiente para trabajar.

4

Por supuesto. Por favor refiérase a la página this. Está buscando un atributo llamado colspan para celdas de encabezados de tabla.

6

Si solo tiene 2 columnas, le sugiero que utilice <caption>. De lo contrario, use colspan como se sugiere en otras respuestas.

<table> 
    <caption>This will span all columns.</caption> 
    <tr><td>column one</td><td>column two</td></tr> 
</table> 
0

Podemos hacerlo de una mejor manera.

<table border="1"> 
    <tr> 
    <th colspan="1" scope="colgroup">Test Heading</th> 
    <th colspan="3" scope="colgroup">Mars</th> 
    <th colspan="3" scope="colgroup">Venus</th> 
    <th colspan="3" scope="colgroup">Test</th> 
    </tr> 
    <tr> 
    <th rowspan="2"></th> 
    <th scope="col">Produced</th> 
    <th scope="col">Sold</th> 
    <th scope="col">Sold</th> 
    <th scope="col">Produced</th> 
    <th scope="col">Sold</th> 
    <th scope="col">Sold</th> 
    <th scope="col">Test 1</th> 
    <th scope="col">Test 2</th> 
    <th scope="col">Test 3</th> 
    </tr> 
</table> 

Visite Table Ref From w3.org si quiere saber más.

Cuestiones relacionadas