th tag in HTML
- 24-07-2022
- Trung Minh
- 0 Comments
The th tag defines a header cell in an HTML table.
An HTML table has two types of cells:
- Header cells: cells that contain title information, use the th tag to create a title box. Text in the title box will be bold and centered by default.
- Standard cell: contains the data of the table, use the td tag to create. Text in standard cells will print normally and are left aligned by default.
Use the th tag in conjunction with the table, tr, and td tags to create tables in HTML.
Using
Example : Use a combination of the th tag with the table, tr and td tags to create a simple 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>