![]() |
Definition and Usage
The
The Browsers can use these elements to enable scrolling of the table body independently of the header and footer. Also, when printing a large table that spans multiple pages, these elements can enable the table header and footer to be printed at the top and bottom of each page.
Note:
The
The
Tip:
The <thead>, Browser Support
Global Attributes
The Event Attributes
The |
Example:
HTML
<!DOCTYPE html>
<html>
<head>
<style>
table, th, td { border: 1px solid black;
}
</style>
</head>
<body>
<h1>The thead, tbody, and tfoot elements</h1>
<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>
</body>
</html>
The thead, tbody, and tfoot elements - Styled with CSS
Example:
HTML
<!DOCTYPE html>
<html>
<head>
<style>
thead {color:green;}
tbody {color:blue;}
tfoot {color:red;}
table, th, td { border: 1px solid black;
}
</style>
</head>
<body>
<h1>The thead, tbody, and tfoot elements - Styled with CSS</h1>
<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>
</body>
</html>
Right-align content in tbody
Example:
HTML
<!DOCTYPE html>
<html>
<head>
<style>
table, th, td { border: 1px solid black;
}
</style>
</head>
<body>
<h1>Right-align content in tbody</h1>
<table style="width:100%"> <thead> <tr> <th>Month</th> <th>Savings</th> </tr> </thead> <tbody style="text-align:right"> <tr> <td>January</td> <td>$100</td> </tr> <tr> <td>February</td> <td>$80</td> </tr> </tbody>
</table>
</body>
</html>
Vertical-align content in tbody
Example:
HTML
<!DOCTYPE html>
<html>
<head>
<style>
table, th, td { border: 1px solid black;
}
</style>
</head>
<body>
<h1>Vertical-align content in tbody</h1>
<table style="width:50%;"> <tr> <th>Month</th> <th>Savings</th> </tr> <tbody style="vertical-align:bottom"> <tr style="height:100px"> <td>January</td> <td>$100</td> </tr> <tr style="height:100px"> <td>February</td> <td>$80</td> </tr> </tbody>
</table>
</body>
</html>
Most browsers will display the
<tbody>
element with the following default values.
Example:
HTML
<style>
tbody { display: table-row-group; vertical-align: middle; border-color: inherit;
}
</style>
html tbody |
How to create HTML <tbody> Tag | HTML Tag |
How to set Style <thead>, <tbody>, and <tfoot> with CSS | HTML Tag |
How to align content inside <tbody> (with CSS) | HTML Tag |
How to vertical align content inside <tbody> (with CSS) | HTML Tag |
How to set Default CSS Settings on HTML <tbody> Tag | HTML Tag |
Type
: |
Develop |
Category
: |
Web Tutorial |
Sub Category
: |
HTML Tag |
Uploaded by
: |
Admin |
Read Article https://horje.com/learn/1434/reference