USE OF LISTS IN HTML

Similarly to tables, lists are used on websites to arrange information. In HTML, you can make two types of lists:

< Table > Tag

Tables are defined by the < table > tag. To begin building a table., you would nest the < table > tag in the < body > of your HTML page.

<body>

....<table>

....</table> < / table >

</body>

The above code does not make a table functional because you have not added the rows, columns, and content, but it provides the basis for a table.

Adding Column Headers To Our Tables

In order for the columns in our tables to have their own headers, we use the ><th> tag to define them and nest them into our <table> tag.

By default, table headings are bold and centered.

In order for us to add additional rows to our table, we continue to reuse the <tr> tag to continue to define each of the rows.

However, to populate each row cell with data, we nest that cell in <td> tags in order for them to appear in their respective column. The <td> elements are the data containers of the table.

For example, let’s say we wanted to add two rows to our tables and make sure that each of the columns in the row had content, we’d model the code as follows:

Naming Your Table

You can use the < caption > tag to give your table a title.

The < caption > tag must be immediately placed after the opening < table > tag.

For example, if we wanted to name this table Test Table, we would include a < caption > tag as follows: