C-Sharp | Java | Python | Swift | GO | WPF | Ruby | Scala | F# | JavaScript | SQL | PHP | Angular | HTML
HTML <th> tagIn an HTML table there are two types of cells:
HTML <th> tag is used to define the header cells of an HTML table. The header cell renders as bold and centered by default on the browser, but you can change its default style using CSS properties. The <th> tag must be used as a child element of the <tr> element within <table> element. The size of the table is auto-adjustable as per the content size. Syntax<th>Content....... </th> Following are some specifications about the HTML <th> tag
Example<!DOCTYPE html> <html> <head> <title>HTML th Tag</title> <style> table{ border-collapse: collapse; width: 70%;} th,td{ background-color: #528b8b; padding: 10px; } </style> </head> <body> <h2>Example of th tag</h2> <table border="1"> <tr> <th>Month</th> <th>Date</th> </tr> <tr> <td>January</td> <td>20.01.2018</td> </tr> <tr> <td>February</td> <td>01.02.2018</td> </tr> <tr> <td>March</td> <td>15.03.2018</td> </tr> </table> </body> </html> Output: Attribute:Tag-specific attributes:
Global attribute:The <th> tag supports the Global attributes in HTML. Event attribute:The <th> tag supports the Event attributes in HTML. Supporting Browsers
Next TopicHTML thead Tag
|