In this discussion, We will introduce about the use of <table> tag in html5. This tag is used to create the table in the html document . Simple table can have any no of <th>(table header), <tr>(table row), <td>(table cell) tag. The <caption> tag defines the title of the table and used just after the <table> tag. The <caption> tag used only once for a <table> tag. The caption by default apears centered and above the table. There is no specific attribute of this tag and "align" attribute is not supported in html5.
| <table>Table Content </table> |
This tag have a "summary" attribute which specify the summary of the table. but we avoid the use of this attribute and use caption tag if summary required.
Example:table_tag.html
| <!DOCTYPE html> <html> <head> <title>Example of table tag</title> </head> <body> <table border="1"> <caption><b> Table</b></caption> <tr> <th>Employee</th> <th>DOB</th> </tr> <tr> <td>Gyan singh</td> <td>1-3-87</td> </tr> <tr> <td>Bikrant</td> <td>14-2-86</td> </tr> </table> </body> </html> |
Output:
Difference between html4.01 and html5:
In table tag "summary" attribute is new in the html5.
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.