HTML <tfoot> 태그


예시

<thead>, <tbody> 및 <tfoot> 요소가 있는 HTML 테이블:

<table>
  <thead>
    <tr>
      <th>Month</th>
      <th>Savings</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>January</td>
      <td>$100</td>
    </tr>
    <tr>
      <td>February</td>
      <td>$80</td>
    </tr>
  </tbody>
  <tfoot>
    <tr>
      <td>Sum</td>
      <td>$180</td>
    </tr>
  </tfoot>
</table>

아래에서 더 많은 "직접 사용해 보기" 예를 살펴보세요.


정의 및 사용

<tfoot>태그는 HTML 테이블의 바닥글 내용을 그룹화하는 데 사용됩니다 .

<tfoot>요소는 <thead> 및 <tbody> 요소와 함께 사용되어 테이블 부분 (바닥글, 머리글, 본문)을 지정합니다.

브라우저는 이러한 요소를 사용하여 머리글 및 바닥글과 별도로 테이블 본문을 스크롤할 수 있습니다. 또한 여러 페이지에 걸쳐 있는 큰 표를 인쇄할 때 이러한 요소를 사용하면 표 머리글과 바닥글을 각 페이지의 위쪽과 아래쪽에 인쇄할 수 있습니다.

참고: 요소 에는 내부 <tfoot>에 하나 이상의 <tr> 태그가 있어야 합니다.

태그 는 <table> 요소 의 자식으로 <caption> , <colgroup> , <thead><tbody><tfoot> 요소 뒤 의 컨텍스트에서 사용해야 합니다 .

팁: <thead>, <tbody> 및 <tfoot>요소는 기본적으로 테이블 레이아웃에 영향을 주지 않습니다. 그러나 CSS를 사용하여 이러한 요소의 스타일을 지정할 수 있습니다(아래 예 참조)!


브라우저 지원

Element
<tfoot> Yes Yes Yes Yes Yes

전역 속성

<tfoot>태그는 HTML의 전역 속성도 지원 합니다 .


이벤트 속성

<tfoot>태그는 HTML의 이벤트 속성 도 지원합니다 .



더 많은 예

예시

CSS로 <thead>, <tbody> 및 <tfoot> 스타일 지정:

<html>
<head>
<style>
thead {color: green;}
tbody {color: blue;}
tfoot {color: red;}

table, th, td {
  border: 1px solid black;
}
</style>
</head>
<body>

<table>
  <thead>
    <tr>
      <th>Month</th>
      <th>Savings</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>January</td>
      <td>$100</td>
    </tr>
    <tr>
      <td>February</td>
      <td>$80</td>
    </tr>
  </tbody>
  <tfoot>
    <tr>
      <td>Sum</td>
      <td>$180</td>
    </tr>
  </tfoot>
</table>

예시

<tfoot> 내부의 콘텐츠를 정렬하는 방법(CSS 사용):

<table style="width:100%">
  <tr>
    <th>Month</th>
    <th>Savings</th>
  </tr>
  <tr>
    <td>January</td>
    <td>$100</td>
  </tr>
  <tr>
    <td>February</td>
    <td>$80</td>
  </tr>
  <tfoot style="text-align:center">
    <tr>
      <td>Sum</td>
      <td>$180</td>
    </tr>
  </tfoot>
</table>

예시

<tfoot> 내부 콘텐츠를 세로로 정렬하는 방법(CSS 사용):

<table style="width:100%">
  <tr>
    <th>Month</th>
    <th>Savings</th>
  </tr>
  <tr>
    <td>January</td>
    <td>$100</td>
  </tr>
  <tr>
    <td>February</td>
    <td>$80</td>
  </tr>
  <tfoot style="vertical-align:bottom">
    <tr style="height:100px">
      <td>Sum</td>
      <td>$180</td>
    </tr>
  </tfoot>
</table>

기본 CSS 설정

대부분의 브라우저는 <tfoot>다음 기본값으로 요소를 표시합니다.

tfoot {
  display: table-footer-group;
  vertical-align: middle;
  border-color: inherit;
}