(해보기) 표 만들기
아래 이미지를 보고 표를 직접 만들어봅시다!

표 아래의 제목은 <caption>으로 만들고 caption-side: bottom으로 아래에 둡니다.
코드를 쓰기 전에 아래를 세어 보세요.
-
표는 모두 몇 열인가요? 첫 줄에서 합쳐진 칸을 풀어서 세어 보세요(답은 8열).
-
합쳐진 칸은 어디인가요? 한국사·영어 영역은 아래 줄까지 이어지는
rowspan="2", 탐구 영역은 옆 칸까지 이어지는colspan="2"입니다. -
표준점수·백분위 두 줄에서 한국사·영어·제2외국어 자리는 빈 칸 하나(
rowspan="2")입니다. 07-1 3.2의 규칙대로 백분위 줄은 그 세 자리를 빼고 칸을 5개만 씁니다. -
맨 아래 '등급' 줄은
<tfoot>입니다. -
힌트

힌트 그림 아래의 캡션은 '대학수능능력시험'으로 잘못 적혀 있습니다. 여러분의 표에는 '대학수학능력시험'으로 쓰세요.
-
스타일을 추가하고 싶다면?
<!DOCTYPE html> <html lang="ko"> <head> <meta charset="UTF-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <title>table</title> <style> table { border-collapse: collapse; border: 3px solid #000; table-layout: fixed; width: 100%; } caption { caption-side: bottom; margin-top: 20px; } th, td { border: 1px solid #000; padding: 6px 20px; } th { background-color: #eee; } td { text-align: center; } tfoot { font-weight: bold; } </style> </head> <body> <!-- 이곳에 작성해보세요 --> </body> </html>
다 만들었으면 아래 답과 비교해 보세요.
답 보기
<table>
<caption>
2023 학년도 대학수학능력시험 성적통지표
</caption>
<thead>
<tr>
<th>구분</th>
<th rowspan="2">한국사 영역</th>
<th>국어 영역</th>
<th>수학 영역</th>
<th rowspan="2">영어영역</th>
<th colspan="2">탐구 영역</th>
<th>제 2 외국어<br />/한문 영역</th>
</tr>
<tr>
<th>선택과목</th>
<th>화법과 작문</th>
<th>확률과 통계</th>
<th>생활과 윤리</th>
<th>지구과학 1</th>
<th>독일어</th>
</tr>
</thead>
<tbody>
<tr>
<th>표준점수</th>
<td rowspan="2"></td>
<td>131</td>
<td>137</td>
<td rowspan="2"></td>
<td>53</td>
<td>64</td>
<td rowspan="2"></td>
</tr>
<tr>
<th>백분위</th>
<td>93</td>
<td>95</td>
<td>75</td>
<td>93</td>
</tr>
</tbody>
<tfoot>
<tr>
<th>등급</th>
<td>2</td>
<td>2</td>
<td>2</td>
<td>1</td>
<td>1</td>
<td>2</td>
<td>2</td>
</tr>
</tfoot>
</table>
table {
border-collapse: collapse;
border: 3px solid #000;
table-layout: fixed;
width: 100%;
}
caption {
caption-side: bottom;
margin-top: 20px;
}
th,
td {
border: 1px solid #000;
padding: 6px 4px;
}
th {
background-color: #eee;
}
td {
text-align: center;
}
tfoot {
font-weight: bold;
}
마지막 수정