Elements

<caption>: 표 설명 요소

HTML <caption> 요소는 표의 설명 또는 제목을 나타냅니다. <table> <caption> He-Man and Skeletor facts </caption> <tr> <td></td> <th sc...

· 3min read · 2 views

HTML <caption> 요소는 표의 설명 또는 제목을 나타냅니다.

<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>
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;
}
콘텐츠 카테고리 없음
가능한 콘텐츠 플로우 콘텐츠.
태그 생략 바로 뒤에 스페이스나 주석이 오지 않으면 닫는 태그를 생략할 수 있습니다.
가능한 부모 요소 <table> 요소. 첫 번째 자식이어야 합니다.
가능한 ARIA 역할 없음
DOM 인터페이스 `HTMLTableCaptionElement`

특성

이 요소는 전역 특성만 포함합니다.

Deprecated attributes

The following attributes are deprecated and should not be used. They are documented below for reference when updating existing code and for historical interest only.

  • align
    • : This enumerated attribute indicates how the caption must be aligned with respect to the table. It may have one of the following values:

      • left
        • : The caption is displayed to the left of the table.
      • top
        • : The caption is displayed above the table.
      • right
        • : The caption is displayed to the right of the table.
      • bottom
        • : The caption is displayed below the table.

      Do not use this attribute, as it has been deprecated. The <caption> element should be styled using the CSS properties caption-side and text-align.

사용 일람

<caption> 요소는 부모 <table> 요소의 첫 번째 자식이어야 합니다.

<caption> 요소를 가진 <table> 요소가 만약 <figure> 요소의 유일한 자식인 경우, <figcaption>을 대신 사용하세요.

예제

다음의 간단한 예제는 설명을 포함한 표를 보입니다.

<table>
  <caption>
    Example Caption
  </caption>
  <tr>
    <th>Login</th>
    <th>Email</th>
  </tr>
  <tr>
    <td>user1</td>
    <td>[email protected]</td>
  </tr>
  <tr>
    <td>user2</td>
    <td>[email protected]</td>
  </tr>
</table>
caption {
  caption-side: top;
  align: right;
}
table {
  border-collapse: collapse;
  border-spacing: 0px;
}
table,
th,
td {
  border: 1px solid black;
}

Related Docs

Elements

<strong>: 강한 중요 요소

<strong> HTML 요소는 강한 중요성, 중대함 혹은 긴급한 내용임을 나타냅니다. 브라우저는 일반적으로 이 내용을 굵은 글씨로 렌더링합니다. <p> ... the most...

1min read 1 views
Elements

<style>: 스타일 정보 요소

HTML <style> 요소는 문서나 문서 일부에 대한 스타일 정보를 포함합니다. <style> p { color: #26b72b; } code { font-weight: bold; } </styl...

2min read 3 views
Elements

<sub>: 아래 첨자 요소

HTML <sub> 요소는 활자 배치를 아래 첨자로 해야 하는 인라인 텍스트를 지정합니다. 아래 첨자는 보통 더 작은 글씨 크기를 가지고, 기준선을 아래로 내려 렌더...

2min read 3 views
Elements

<template>: 콘텐츠 템플릿 요소

HTML <template> 요소는 페이지를 불러온 순간 즉시 그려지지는 않지만, 이후 JavaScript를 사용해 인스턴스를 생성할 수 있는 HTML 코드를 담을 방법을 제공합...

1min read 3 views

Comments (0)

No comments yet. Be the first to comment!

Leave a Comment

로그인 후 댓글을 남길 수 있습니다.