2012-01-25 13 views

risposta

40

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

di estrapolare un po '...

<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> 

Questo dovrebbe darvi abbastanza da lavorare.

4

Naturalmente. Si prega di fare riferimento alla pagina this. Stai cercando un attributo chiamato colspan per le celle delle intestazioni delle tabelle.

6

Se si dispone solo di 2 colonne, suggerirei di utilizzare <caption>. Altrimenti, usa colspan come suggerito in altre risposte.

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

Possiamo farlo in modo migliore.

<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> 

Si prega di visitare Table Ref From w3.org se volete saperne di più.

Problemi correlati