37 of 133 menu

The tbody tag

The tbody tag defines the main part of the table. It is used to group rows so that CSS styles can be applied to a group at once. There can be any number of tbody tags in one table.

The tbody tag is often used together with thead and tfoot to define the header, body, and footer of an HTML table. By default, the browser will put the contents of tfoot at the foot of the table, and thead at the top.

Example

Let's add red text color to the group of rows united by the tbody tag using the color property:

<table> <thead> <tr> <th>Name</th> <th>Surn</th> <th>Salary</th> </tr> </thead> <tbody> <tr> <td>name1</td> <td>surn1</td> <td>200$</td> </tr> <tr> <td>name2</td> <td>surn2</td> <td>1000$</td> </tr> </tbody> <tfoot> <tr> <td>count: 2</td> <td>-</td> <td>total: 1200$</td> </tr> </tfoot> </table> tbody { color: red; } table, td, th { border: 1px solid black; }

:

See also

  • tags thead, tfoot,
    which group the rows of the table
  • tag caption,
    which sets the title of the entire table
  • attributes rowspan and colspan,
    which combine the rows and columns of a table
English
AfrikaansAzərbaycanБългарскиবাংলাБеларускаяČeštinaDanskDeutschΕλληνικάEspañolEestiSuomiFrançaisहिन्दीMagyarՀայերենIndonesiaItaliano日本語ქართულიҚазақ한국어КыргызчаLietuviųLatviešuМакедонскиMelayuမြန်မာNederlandsNorskPolskiPortuguêsRomânăРусскийසිංහලSlovenčinaSlovenščinaShqipСрпскиSrpskiSvenskaKiswahiliТоҷикӣไทยTürkmenTürkçeЎзбекOʻzbekTiếng Việt
We use cookies for website operation, analytics, and personalization. Data processing is carried out in accordance with the Privacy Policy.
accept all customize decline