What are the various tags used in table . Explain with an example.
Answers
Answered by
14
The <tr> element defines a table row, the <th> element defines a table header, and the <td> element defines a table cell. A more complex HTML table may also include <caption>, <col>, <colgroup>, <thead>, <tfoot>, and <tbody> elements. Note: Tables should not be used for page layout!
Answered by
3
Various tags used in table are <TR> <TD> <TH>.
Explanation:
<TR> - Table Row
<TD> - Table Data
<TH> - Table heading
Eg:
<TABLE>
<TR>
<TH> Subject </TH>
<TH>Number of Staff</TH>
</TR>
<TR>
<TD>English</TD>
<TD>15</TD>
</TR>
<TR>
<TD>Tamil</TD>
<TD>12</TD>
</TR>
<TR>
<TD>Mathematics</TD>
<TD>10</TD>
</TR>
<TR>
<TD>Science</TD>
<TD>18</TD>
</TR>
<TR>
<TD>Social</TD>
<TD>8</TD>
</TR>
</TABLE>
So here <TH> tag will automatically print the text with bold font. <TD> will represent the data and <TR> will create rows. You can also create table with any number of rows and columns with the help of tags described in the answer. You can include attributes to provide back colour, text colour, etc.
Similar questions
India Languages,
7 months ago
Math,
7 months ago
Hindi,
7 months ago
Computer Science,
1 year ago
Art,
1 year ago
English,
1 year ago
Biology,
1 year ago