[HTML / XHTML] balise de table


Temps d'écriture : 2014-06-28 22:41:50

balise de table

Un exemple de balise de table. Si vous n'êtes pas familier avec la balise colgroup parmi les balises utilisées, veuillez vous référer au lien [http://www.w3schools.com/tags/tag_colgroup.asp[http://www.w3schools.com/tags/ tag_colgroup.asp). Notez que la balise tfoot doit être placée après thead dans la grammaire et la sortie est imprimée après tbody.

Presque tous les éléments utilisés dans la balise table sont inclus, vous pouvez donc l'utiliser après avoir supprimé les parties inutiles.

<table>  
<!--Captoin 지정 -->  
<caption>Sample Table</caption>  
  
<!-- 컬럼별 색상을 지정하기 위한 colgroup -->  
<colgroup>  
<col />  
<col />  
<col />  
</colgroup>  
  
<!-- 테이블 헤더 -->  
<thead>  
<tr>  
<th>A Head</th>  
<th>B Head</th>  
<th>C Head</th>  
</tr>  
</thead>  
  
<!-- 테이블 바디 -->  
<tbody>  
<tr>  
<td>A1</td>  
<td>B1</td>  
<td>C2</td>  
</tr>  
<tr>  
<td>A2</td>  
<td>B2</td>  
<td>C2</td>  
</tr>  
<tr>  
<td>A3</td>  
<td>B3</td>  
<td>C3</td>  
</tr>  
</tbody>  
  
<!-- 테이블 푸터 -->  
<tfoot>  
<tr>  
<th>A Foot</th>  
<th>B Foot</th>  
<th>C Foot</th>  
</tr>  
</tfoot>  
</table>  

Ceci est le résultat de sortie.

Exemple de tableau


A Head B Head C Head
A1 B1 C2
A2 B2 C2
A3 B3 C3
A Foot B Foot C Foot


Pour référence, il s'agit du css appliqué à la table d'exemple. Pour thead et tfoot, l'alignement central est la valeur par défaut.

/** 테이블 라인 **/  
table, th, td {  
border: 1px solid black;  
}  
  
/** 테이블 태그 설정 **/  
table {  
border-collapse:collapse;  
margin-left: 20px;  
width: 800px;  
}  
  
/** header, footer 색상 **/  
thead th,tfoot th{  
background-color: #2598BF;  
}  
  
/** 패딩 **/  
thead th, tfoot th, tr td{  
padding:5px;  
}