테이블 기본 태그

<table>
		<caption>성적표</caption>
		<tr>
			<th>반</th>
			<th>이름</th>
			<th>국어</th>
			<th>영어</th>
			<th>수학</th>
			<th>과학</th>
		</tr>
		<tr>
			<td>1반</td>
			<td>홍길동</td>
			<td>90점</td>
			<td>80점</td>
			<td>50점</td>
			<td>60점</td>
		</tr>
</table>

Untitled

테이블의 구조를 지정하는 태그

<table>
		<caption>성적표</caption>
		<thead>
			<tr>
				<th>반</th>
				<th>이름</th>
				<th>국어</th>
				<th>영어</th>
				<th>수학</th>
				<th>과학</th>
			</tr>
		</thead>
		<tbody>
			<tr>
				<td>1반</td>
				<td>홍길동</td>
				<td>90점</td>
				<td>80점</td>
				<td>50점</td>
				<td>60점</td>
			</tr>
			<tr>
				<td>1반</td>
				<td>김영희</td>
				<td>50점</td>
				<td>60점</td>
				<td>90점</td>
				<td>100점</td>
			</tr>
		</tbody>
		<tfoot>
			<tr>
				<th>평균</th>
				<td></td>
				<td>70점</td>
				<td>70점</td>
				<td>70점</td>
				<td>80점</td>
			</tr>
		</tfoot>
	 </table>

Untitled

행이나 열을 합치는 속성

<table>
		<caption>성적표</caption>
		<thead>
			<tr>
				<th>반</th>
				<th>이름</th>
				<th>국어</th>
				<th>영어</th>
				<th>수학</th>
				<th>과학</th>
			</tr>
		</thead>
		<tbody>
			<tr>
				<td rowspan="2">1반</td>
				<td>홍길동</td>
				<td>90점</td>
				<td>80점</td>
				<td>50점</td>
				<td>60점</td>
			</tr>
			<tr>
				<!-- 두 행을 합치기위해 td태그 하나 주석 -->
				<!-- <td>1반</td> -->
				<td>김영희</td>
				<td>50점</td>
				<td>60점</td>
				<td>90점</td>
				<td>100점</td>
			</tr>
		</tbody>
		<tfoot>
			<tr>
				<!-- 두 열을 합치기위해 td태그 하나 주석 -->
				<th colspan="2">평균</th>
				<!-- <td></td> -->
				<td>70점</td>
				<td>70점</td>
				<td>70점</td>
				<td>80점</td>
			</tr>
		</tfoot>
	 </table>

Untitled

열을 묶어 주는 태그

<table>
		<caption>성적표</caption>
		<colgroup>
			<col>
			<col>
			<col>
			<!-- 4번째 열에 스타일 지정 -->
			<col class="col2">
			<col>
			<col>
		</colgroup>
		<thead>
			<tr>
				<th>반</th>
				<th>이름</th>
				<th>국어</th>
				<th>영어</th>
				<th>수학</th>
				<th>과학</th>
			</tr>
		</thead>
		<tbody>
			<tr>
				<td rowspan="2">1반</td>
				<td>홍길동</td>
				<td>90점</td>
				<td>80점</td>
				<td>50점</td>
				<td>60점</td>
			</tr>
			<tr>
				<!-- <td>1반</td> -->
				<td>김영희</td>
				<td>50점</td>
				<td>60점</td>
				<td>90점</td>
				<td>100점</td>
			</tr>
		</tbody>
		<tfoot>
			<tr>
				<th colspan="2">평균</th>
				<!-- <td></td> -->
				<td>70점</td>
				<td>70점</td>
				<td>70점</td>
				<td>80점</td>
			</tr>
		</tfoot>
 </table>

Untitled