HTML Notes
HTML
HTML Tags and Elements
Attributes and Hyperlinks
Headings and Lists
Class and id attributes
Semantic Elements
Inline and Block-Level Elements
Div and Span
img
Tables
Forms
Heading
Q
1
Mention the HTML Tags used to display data in tabular form.
Ans
The <table> tag defines a table in HTML. Each table row is defined as <tr> tag. Each header is defined with <th> tag. The data in each cell in table is defined by <td> tag. By default, text in <th> is bold and centered and text in <td> is regular and left aligned.
Q
2
How can rows be made to Span many columns or rows in HTML?
Ans
Cells may span in several rows and columns. This is done with the help of attributes “rowspan” and “colspan” of &<th> and <td> tag. Function of <colspan> is that it allows a single table cell to span the width of more than one cell or column. Function of <rowspan> is that it allows a single table cell to span the height of more than one cell or row.
Sometimes it makes sense for a cell to span multiple columns or multiple rows. This might be used for a header cell that titles a group of columns, or a side-bar that groups rows of entries. This is why these attributes are used and are a significant part of table in HTML.
Syntax- <Table>
<tr><td colspan= "add_number_ofcols"></td></tr>
<tr> <td rowspan= "add number of rows></td></tr>
</table>
Q
3
Explain the use of caption Tag in HTML.
Ans
The <caption> tag defines a table in HTML. The <caption> tag must be inserted immediately after the <table>tag.
Example of <caption> tag-
<table>
<caption>Registration record </caption>
<tr>
<th>Month</th> <th>Number of registration </th>
</tr>
<tr>
<td>January</td><td>50</td>
</tr> </table>