HTML Anchor Tag
- Purpose: To create hyperlinks, which are clickable links that take users to another webpage, a specific section within the same page, or any other URL.
- Tags:
- <table>: Defines the start and end of the table.
- <tr>: Defines a table row.
- <th>: Defines a table header cell (usually displayed with bold text and centered).
- <td>: Defines a table data cell.
<table> <tr> <th>Name</th> <th>Age</th> <th>City</th> </tr> <tr> <td>John Doe</td> <td>30</td> <td>New York</td> </tr> <tr> <td>Jane Smith</td> <td>25</td> <td>London</td> </tr> </table>
- Attributes
- Table-level Attributes
- border: Specifies the width of the border around the table cells.
- width: Sets the width of the table (in pixels or percentage).
- cell spacing: Controls the space between cells.
- cellpadding: Controls the space between cell content and the cell border.
- align: Aligns the table within its container (e.g., “left”, “center”, “right”).
- Row and Column Attributes
- colspan: Allows a cell to span multiple columns.
- rowspan: Allows a cell to span multiple rows.
- Header and Data Cell Attributes
- align: Aligns the content within a cell (e.g., “left”, “center”, “right”).
- valign: Aligns the content vertically within a cell (e.g., “top”, “middle”, “bottom”).
- Table-level Attributes
- Example:
<table border="1" width="80%" cellspacing="5" cellpadding="5">
<caption>Employee Data</caption>
<tr>
<th>Name</th>
<th>Age</th>
<th>City</th>
</tr>
<tr>
<td>John Doe</td>
<td>30</td>
<td>New York</td>
</tr>
<tr>
<td colspan="2">Jane Smith</td> <td>London</td>
</tr>
</table>