Tables
Learn all the syntax you need to create tables in your HTML documents.
StartKey Concepts
Review core concepts you need to learn to master this subject
<tr>
Table Row Element
<td>
Table Data Element
<thead>
Table Head Element
rowspan
Attribute
<tbody>
Table Body Element
<th>
Table Heading Element
colspan
Attribute
<tfoot>
Table Footer Element
<tr>
Table Row Element
<tr>
Table Row Element
<table>
<tr>
...
</tr>
</table>
The table row element, <tr>
, is used to add rows to a table before adding table data and table headings.
HTML Tables
Lesson 1 of 1
- 1There are many websites on the Internet that display information like stock prices, sports scores, invoice data, and more. This data is naturally tabular in nature, meaning that a table is often th…
- 2Before displaying data, we must first create the table that will contain the data by using the element. The element will contain all of the tabular data we plan on displaying.
- 3In many programs that use tables, the table is already predefined for you, meaning that it contains the rows, columns, and cells that will hold data . In HTML, all of these components must be crea…
- 4Rows aren’t sufficient to add data to a table. Each cell element must also be defined. In HTML, you can add data using the table data element: . 73 81 In the example a…
- 5Table data doesn’t make much sense without titles to describe what the data represents. To add titles to rows and columns, you can use the table heading element: . The table heading element is…
- 6So far, the tables you’ve created have been a little difficult to read because they have no borders. In older versions of HTML, a border could be added to a table using the border attribute and s…
- 7What if the table contains data that spans multiple columns? For example, a personal calendar could have events that span across multiple hours, or even multiple days. Data can span columns using…
- 8Data can also span multiple rows using the rowspan attribute. The rowspan attribute is used for data that spans multiple rows (perhaps an event goes on for multiple hours on a certain day). It acc…
- 9Over time, a table can grow to contain a lot of data and become very long. When this happens, the table can be sectioned off so that it is easier to manage. Long tables can be sectioned off using …
- 10In the last exercise, the table’s headings were kept inside of the table’s body. When a table’s body is sectioned off, however, it also makes sense to section off the table’s column headings using …
- 11The bottom part of a long table can also be sectioned off using the element. Quarter Revenue Costs Q1 $10M $7.5M …
- 12Tables, by default, are very bland. They have no borders, the font color is black, and the typeface is the same type used for other HTML elements. CSS…
What you'll create
Portfolio projects that showcase your new skills
How you'll master it
Stress-test your knowledge with quizzes that help commit syntax to memory