English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

Manual de referência HTML

大全 de etiquetas HTML

HTML: <tbody> tag

O elemento HTML Table Body (<tbody>) encapsula um grupo de linhas de tabela (<tr>), representando o corpo da tabela (<table>).

Exemplo online

Tabela com elementos <thead>, <caption>, <tfoot> e <tbody>:

!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"> 
<title>Tutorial Básico(oldtoolbag.com)</title> 
<style type="text/css">
thead {cor: #009900;}
tbody {cor: #0000cc;}
tfoot {cor: #ff0000;}
</style>
</head>
<body>
<table border="1">
<caption>Budget do Conselho< 2020</caption>
  <thead>
    <tr>
      <th>Mês</th>
      <th>Savings</th>
    </tr>
  </<thead>
  <tfoot>
    <tr>
      <td>Sum</td>
      <td>$180</td>
    </tr>
  </tfoot>
  <tbody>
    <tr>
      <td>January</td>
      <td>$100</td>
    </tr>
    <tr>
      <td>February</td>
      <td>$80</td>
    </tr>
  </tbody>
</table>
<p><b>Dica:</b> thead, tbody, e tfoot por padrão não afetam o layout da tabela. No entanto, você pode usar CSS para definir estilos para esses elementos, alterando assim a aparência da tabela.</p>
</body>
</html>
Teste e veja ‹/›

Compatibilidade do navegador

IEFirefoxOperaChromeSafari

Todos os navegadores populares suportam a tag <tbody>.

Definição e instruções de uso das tags

O rótulo <tbody> é usado para combinar o conteúdo principal da tabela HTML.

O elemento <tbody> deve ser usado com <thead> e <tfoot> Esses elementos combinados são usados para definir as partes de uma tabela (corpo, cabeçalho, rodapé).

Ao usar esses elementos, o navegador tem a capacidade de suportar a rolagem independente do cabeçalho e rodapé da tabela, permitindo que o cabeçalho e o rodapé sejam impressos em cada página que contém dados da tabela, quando a tabela é impressa.

O rótulo <tbody> deve ser usado nas seguintes situações: como filho do elemento <table>, após os elementos <caption>, <colgroup> e <thead>.

Dicas e Avisos

Atenção:O elemento <tbody> deve conter pelo menos um ou mais rótulos <tr> dentro dele.

Atenção:A marcação <tbody> deve aparecer após os marcadores <caption>, <colgroup> e <thead> dentro da tabela, mas antes do marcador <tfoot>.

Hint:<thead>, <tbody> and <tfoot> elements do not affect the table layout by default. However, you can use CSS to define styles for these elements, thus changing the appearance of the table.

HTML 4.01 with HTML5differences

in HTML 5 no longer supports HTML 4.01 Any attribute of the <tbody> tag.

Attribute

AttributeValueDescription
alignright
 left
 center
 justify
 char
HTML5 Not supported. Defines the alignment method of the content within the <tbody> element.
charcharacterHTML5 Not supported. Specifies the character by which the content within the <tbody> element is aligned.
charoffnumberHTML5 Not supported. Specifies the offset of the first alignment character in the content of the <tbody> element.
valigntop
 middle
 bottom
 baseline
HTML5 Not supported. Specifies the vertical alignment of the content within the <tbody> element.

Global attributes

The <tbody> tag supports Global attributes of HTML.

Event attributes

The <tbody> tag supports Event attributes of HTML.