Thead tag in HTML
- 24-07-2022
- Trung Minh
- 0 Comments
The thead tag defines the header content of the table.
Thead tag is used in conjunction with thead and tbody tag to specify each part of the table (header, body, footer).
Web browsers can use this element to allow scrolling of the body of the table without regard to thead or thead . In some cases where the table data is large and spans many pages, these elements can help thehead and tfoot be printed at the top and bottom of the page.
When using thead tag you must note that they must be children of the table tag, must be placed after all caption and colgroup tags, and must be placed before the tbody, tfoot, and tr tags.
Using
For example , use thead tag to specify the contents of a table.
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <style> thead {color:green;} tbody {color:blue;} tfoot {color:red;} table, th, td { border: 1px solid black; } </style> </head> <body> <h1>Học html miễn phí tại web888.vn</h1> <table> <thead> <tr> <th>Tên Thẻ</th> <th>Mô tả</th> </tr> </thead> <tfoot> <tr> <td>Tổng</td> <td>3 Thẻ</td> </tr> </tfoot> <tbody> <tr> <td>a</td> <td>tạo siêu liên kết</td> </tr> <tr> <td>p</td> <td>định nghĩa một đoạn văn bản</td> </tr> <tr> <td>br</td> <td>ngắt dòng hiện tại</td> </tr> </tbody> </table> </body> </html>