Introduction
Tables can be used to present data in a structured format. The basic component of any table is a table row (
) and the second row contains two data cells ( | ).
Adding More RowsTo add more rows to the table, we need to add more
Now, the table has three rows, with each row containing two cells. Styling the Table RowsWe can add styles to the table rows using CSS. Add the following style to the element to add a background color to the even rows:
This code will add Merging Table RowsWe can merge two or more adjacent rows into a single row using the rowspan attribute. For example, let's say we want to merge the first two rows into a single row. Replace the first
The Creating Table Cell HeadersWe can use the element to create header cells in the table. Header cells are typically used to describe the content of the columns. To add a header cell to the first column, replace the first | element in the second row with the following code:
|
The element specifies that this is a header cell for the first row.
| SummaryIn this lab, we learned how to create HTML table rows and customize the table using CSS. We also learned how to merge adjacent rows and create header cells in the table. With these skills, you can now create beautiful and structured tables for your web pages. Other HTML Tutorials you may like |
---|