--- title: '
HTML <caption> 요소는 표의 설명 또는 제목을 나타냅니다.
| 콘텐츠 카테고리 | 없음 |
|---|---|
| 가능한 콘텐츠 | 플로우 콘텐츠. |
| 태그 생략 | 바로 뒤에 스페이스나 주석이 오지 않으면 닫는 태그를 생략할 수 있습니다. |
| 가능한 부모 요소 | {{htmlelement("table")}} 요소. 첫 번째 자식이어야 합니다. |
| 가능한 ARIA 역할 | 없음 |
| DOM 인터페이스 | {{domxref("HTMLTableCaptionElement")}} |
이 요소는 전역 특성만 포함합니다.
The following attributes are obsolete and should not be used. They are documented below for reference when updating existing code and for historical interest only.
lefttoprightbottom<caption> 요소는 부모 {{htmlelement("table")}} 요소의 첫 번째 자식이어야 합니다.
<caption> 요소를 가진 <table> 요소가 만약 {{HTMLElement("figure")}} 요소의 유일한 자식인 경우, {{htmlelement("figcaption")}}을 대신 사용하세요.
다음의 간단한 예제는 설명을 포함한 표를 보입니다.
<table>
<caption>Example Caption</caption>
<tr>
<th>Login</th>
<th>Email</th>
</tr>
<tr>
<td>user1</td>
<td>user1@sample.com</td>
</tr>
<tr>
<td>user2</td>
<td>user2@sample.com</td>
</tr>
</table>
caption {
caption-side: top;
align: right;
}
table {
border-collapse: collapse;
border-spacing: 0px;
}
table, th, td {
border: 1px solid black;
}
{{EmbedLiveSample('예제', 650, 100)}}
| Specification | Status | Comment |
|---|---|---|
| {{SpecName('HTML WHATWG', 'tables.html#the-caption-element', '<caption>')}} | {{Spec2('HTML WHATWG')}} | |
| {{SpecName('HTML5 W3C', 'tabular-data.html#the-caption-element', '<caption>')}} | {{Spec2('HTML5 W3C')}} | |
| {{SpecName('HTML4.01', 'struct/tables.html#h-11.2.2', '<caption>')}} | {{Spec2('HTML4.01')}} |
{{Compat("html.elements.caption")}}