Académique Documents
Professionnel Documents
Culture Documents
3
Chapitre
Les tableaux
<TABLE>
<TR>
<TD>cellule 1</TD>
<TD> cellule 2</TD>
</TR>
<TR>
<TD> cellule 3</TD>
<TD> cellule 4</TD>
</TR>
</TABLE>
bordure du tableau (css)
propriété description
Exemple :
td /* Toutes les cellules des tableaux... */
{
border: 1px solid black; /* auront une bordure de
1px */
}
bordure du tableau (css)
En css :
Caption
{caption-side: bottom;}
table
{ border-collapse: collapse; }
td,th
{ border: 1px solid black; }
Tableau structuré
<tbody>
<tr> <td>Mansouri</td> <td>Lamia</td> <td>Tunisie</td> </tr>
<tr> <td>Latulippe</td> <td>Gerard</td> <td>Canada</td> </tr>
<tr> <td>Kilani</td> <td>Amine</td> <td>Tunisie</td> </tr>
<tr> <td>Mohamed</td> <td>salah</td> <td>Tunisie</td> </tr>
<tr> <td>Dupre</td> <td>jean</td> <td>France</td> </tr>
<tr> <td>Kilani</td> <td>Anas</td> <td>Tunisie</td> </tr>
<tr> <td>Jaafar</td> <td>Ahmed</td> <td>Tunisie</td> </tr>
</tbody>
</table>
Entête du tableau <Thead>
thead
tbody
tbody
tfoot
<table>
<thead> <tr> <th> Vitesse mesurée en km/h </th>
<th> Nombre de Véhicules </th>
<th> Sanction opérée</th>
</tr>
</thead>
<tfoot> <tr> <th> Vitesse mesurée en km/h </th>
<th> Nombre de Véhicules </th>
<th> Sanction opérée</th>
</tr>
</tfoot>
<tbody> <tr> <td> de 90 à 110 km/h </td>
<td> 325 </td>
<td> NON </td>
</tr>
<tr> <td> de 110 à 130 km/h </td>
<td> 564 </td>
<td> NON </td>
</tr>
<tr> <td> de 130 à 140 km/h </td>
<td> 323 </td>
<td> NON </td>
</tr>
</tbody>
<tbody >
<tr>
<td> de 140 à 160 km/h </td>
<td> 223 </td>
<td> Amende </td>
</tr>
<tr>
<td> de 160 à 190 km/h </td>
<td> 87 </td>
<td> Retrait </td>
</tr>
</tbody>
</table>
Exemple de regroupement de colonnes
</colgroup>
<!—En-tête et pied du tableau -->
<thead>
<tr>
<th>Date </th>
<th>Titre </th>
<th>Auteur</th>
<th>Quantité </th>
<th>Prix Unitaire </th>
<th>Prix Total </th>
</tr>
</thead>
<tfoot>
<tr>
<th>Date </th>
<th>Titre </th>
<th>Auteur</th>
<th>Quantité </th>
<th>Prix Unitaire </th>
<th>Prix Total </th>
</tr>
</tfoot>
<tbody>
<tr> <td>29/05/2018</td>
<td>XHTML Design</td>
<td>Jeffrey Zeldman</td>
<td>3</td>
<td>32.00 €</td>
<td>96.00 €</td>
</tr>
<tr> <td>15/06/2018</td>
<td>CSS 2 </td>
<td>Raphael Goetter</td>
<td>2</td>
<td>30.00 €</td>
<td>60.00 €</td>
</tr>
<tr> <td>10/09/2018</td>
<td>XHTML et CSS </td>
<td>Jean Engels</td>
<td>5</td>
<td>29.90 €</td>
<td>149.50 €</td>
</tr>
</tbody>
</table>
Fusion des cellules
<table >
<tr> <th>Titre du film</th>
<td>massacre à la tronçonneuse ?</td>
<td>les bisounours font du ski</td>
<td>Lucky luke, seul contre tous ?</td> </tr>
<tr><th>pour les enfants?</th>
<td >Non, trop violent</td>
<td>Oui,adapté</td>
<td rowspan=2>Pour toute la famille</td> </tr>
<tr> <th>pour adolescents?</th>
<td>Oui </td>
<td>Pas assez violent...</td> </tr>
</table>
Application
Créer le tableau suivant en respectant les styles observés