- What does
<table> HTML Tagdo?
- The <table> element is used in conjunction with child elements such as <tr>, <td>, <th>, and others to add tabular data to an HTML document.
Tables for Data, Not Layout
In the early days of the web, it was common for HTML tables to be used to control webpage layout. That was a bad idea then, and is a worse idea now. Not only is it semantically incorrect to use tables in this way, doing so can create accessibility issues and make it much harder to create a responsive website design.
So, what is the proper use of HTML tables? To display tabular data. Some data sets are just easiest to understand and digest when presented in a table. If you have a data set like this to add to a website, an HTML table is the right tool for the job.
As you can see in our code snippet above, there are a lot of elements that go into making an HTML table. We’ve put together a Tables Tutorial that will help you master all of these elements. We’ve also put together a tutorial on styling tables that will help you create tables that render beautifully on any device–as task easier said than done.