Resources | Subject Notes | Information Communication Technology ICT
Be able to insert a table including table header, table rows, table data.
To create a table in HTML, we use the A table is structured into different parts: Here's an example of how to insert a table with a header row, data rows, and data cells: The code above defines a table with three columns: \"Name\", \"Age\", and \"City\". The To insert this table into a web page, you would include the above HTML code within the You can customize tables further using attributes like tag. This tag acts as the container for all the table elements.
Table Structure
: Contains the table header row.
: Contains the main body of the table, including the data rows.
: Represents a table row. : Represents a table header cell (used within ).
: Represents a table data cell (used within ).
Example Table
Name Age City John Doe 30 New York Jane Smith 25 London Peter Jones 40 Paris Explanation of the Code
section defines the header row, and the
section contains the data rows with corresponding data in the
cells. Key Tags
: Defines the HTML table.
: Defines the table header.
: Defines the table body.
: Defines a table row. : Defines a table header cell. : Defines a table data cell. Inserting a Table in a Web Page
section of your HTML document.
Further Considerations
border
to add borders, colspan
to merge cells horizontally, and rowspan
to merge cells vertically. These are beyond the basic objective but are useful for more complex table layouts.