<caption>: 표 설명 요소
HTML <caption> 요소는 표의 설명 또는 제목을 나타냅니다.
HTML <caption> 요소는 표의 설명 또는 제목을 나타냅니다.
HTML
<table>
<caption>
He-Man and Skeletor facts
</caption>
<tr>
<td></td>
<th scope="col" class="heman">He-Man</th>
<th scope="col" class="skeletor">Skeletor</th>
</tr>
<tr>
<th scope="row">Role</th>
<td>Hero</td>
<td>Villain</td>
</tr>
<tr>
<th scope="row">Weapon</th>
<td>Power Sword</td>
<td>Havoc Staff</td>
</tr>
<tr>
<th scope="row">Dark secret</th>
<td>Expert florist</td>
<td>Cries at romcoms</td>
</tr>
</table>
CSS
caption {
caption-side: bottom;
padding: 10px;
font-weight: bold;
}
table {
border-collapse: collapse;
border: 2px solid rgb(140 140 140);
font-family: sans-serif;
font-size: 0.8rem;
letter-spacing: 1px;
}
th,
td {
border: 1px solid rgb(160 160 160);
padding: 8px 10px;
}
th {
background-color: rgb(230 230 230);
}
td {
text-align: center;
}
tr:nth-child(even) td {
background-color: rgb(250 250 250);
}
tr:nth-child(odd) td {
background-color: rgb(240 240 240);
}
.heman {
font: 1.4rem molot;
text-shadow:
1px 1px 1px #fff,
2px 2px 1px #000;
}
.skeletor {
font: 1.7rem rapscallion;
letter-spacing: 3px;
text-shadow:
1px 1px 0 #fff,
0 0 9px #000;
}
| 콘텐츠 카테고리 | 없음 | ||||
|---|---|---|---|---|---|
| 가능한 콘텐츠 | 플로우 콘텐츠. | ||||
| 태그 생략 | 바로 뒤에 스페이스나 주석이 오지 않으면 닫는 태그를 생략할 수 있습니다. | ||||
| 가능한 부모 요소 | `` 요소. 첫 번째 자식이어야 합니다.
특성이 요소는 전역 특성만 포함합니다. Deprecated attributesThe following attributes are deprecated and should not be used. They are documented below for reference when updating existing code and for historical interest only.
사용 일람
예제다음의 간단한 예제는 설명을 포함한 표를 보입니다. HTML CSS 명세브라우저 호환성 |