From the course: HTML for Programmers
Unlock the full course today
Join today to access over 24,800 courses taught by industry experts.
Tables
- [Instructor] A table is a set of data displayed as a series of rows and columns. In the past, tables were used to format or layout information in a webpage, but with the release of CSS floats, Flexbox, and Grid, this need no longer exists. You should only use tables to display data. Suppose we want to create a table to display a list of pets and their owners. The data looks like this. We can start by defining the HTML table element. Next, let's create the table header row. We have four headers, name, breed, age, and owner. We first need to define the header with the <thead> element. The table header element declares that the encapsulated elements will be a series of headers. Next, we declare a new table row using the <tr> element. Inside the table row, we can define our four headers with the <th> element. Now that we've declared our table headers, we can work on our table data. We create the table body using the <tbody>…