html Table 태그

2010.05.23 23:46

Elkha 조회 수:4443

참고 문서  

table.jpg

웹 표준

내가 html 언어를 접할때는 웹 표준에 대한 인식이 어느정도 자리잡혀 있었다. img, hr 같은 단일태그는 닫아 주어야 하고, font 태그보다는 style을 주로 사용해야 한다는 정도는 이미 어깨넘어로 배운 지식이었다. 덕분에 처음부터 div 태그를 주로 사용했었고, 그것에 매우 익숙해졌다. 하지만 div 태그만 사용한덕에 table 태그를 사용할때면 항상 버벅거린다. table 태그에 대해 알아보면서 그 과정을 문서로 정리해본다.

Table 태그의 종류

  • table
  • caption
  • col
  • colgroup
  • thead
  • tbody
  • tfoot
  • tr
  • th
  • td

예제

<table border="1" align="center">
<caption>table 태그의 구성 요소</caption>
<colgroup>
 <col style="background: none repeat scroll 0% 0% rgb(255, 238, 238);"/>
 <col style="background: none repeat scroll 0% 0% rgb(255, 255, 238);"/>
</colgroup>
<thead>
<tr>
 <th>태그명</th>
 <th>설명</th>
</tr>
</thead>
<tbody>
<tr>
 <th>caption</th>
 <td>제목을 표시</td>
</tr>
<tr>
 <th>colgroup</th>
 <td rowspan="2">칼럼(Columns) 요소들을 선택</td>
</tr>
<tr>
 <th>col</th>
</tr>
<tr>
 <th>thead</th>
 <td>표의 머리 부분</td>
</tr>
<tr>
 <th>tbody</th>
 <td>표 본문</td>
</tr>
<tr>
 <th>tfoot</th>
 <td>표의 꼬리 부분</td>
</tr>
<tr>
 <th>tr</th>
 <td>table row. 행을 나눈다.</td>
</tr>
<tr>
 <th>th</th>
 <td>table title. tr 태그에서 구분한 행의 제목을 가리킨다.</td>
</tr>
<tr>
 <th>th</th>
 <td>table data. tr 태그에서 구분한 행을 열 단위로 나눈다.</td>
</tr>
</tbody>
</table>

출력 결과

table 태그의 구성 요소
태그명 설명
caption 제목을 표시
colgroup 칼럼(Columns) 요소들을 선택
col
thead 표의 머리 부분
tbody 표 본문
tfoot 표의 꼬리 부분
tr table row. 행을 나눈다.
th table title. tr 태그에서 구분한 행의 제목을 가리킨다.
th table data. tr 태그에서 구분한 행을 열 단위로 나눈다.
번호 제목 날짜 조회 수
81 vmware with centos 7 secret 2019.08.23 0
80 php-fpm tcp to socket secret 2020.01.25 0
79 net::ERR_CONNECTION_REFUSED secret 2021.10.11 0
78 my.cnf secret 2019.04.11 1
77 To download large files with rsync command. 2023.05.04 21
76 The best configuration of php7.4-fpm / 1.5GB 2023.05.04 23
75 The best configuration of php7.4-fpm / 8GB 2023.05.04 23
74 windows hardware encrypt ssd 2024.01.23 206
73 gearman 은 무엇인가? 2023.06.21 270
72 apache2 AllowOverride config 2023.05.23 278
71 php 에서 비동기 처리하는 방법 2023.06.22 288
70 mysqldump from remote db to my local server. 2023.05.04 421
69 yum install php 7.1 [6] 2018.10.10 687
68 mysql 백업 (shell script) file 2018.10.14 697
67 munin 설치 2018.10.13 787
66 yum install mariadb [2] 2018.10.10 1143
65 웹 백업 (쉘 스크립트) file 2018.10.14 1193
64 certbot apache multiple domain 2019.04.10 1416
63 yum install php-apcu 2019.03.12 1542
62 yum install latest redis file 2019.03.27 1682