The document provides a cheat sheet on HTML table elements including <table>, <tr>, <th>, <td>, <thead>, <tbody>, <tfoot>, <caption>, <col>, <colgroup>. It also gives examples of using these elements and CSS snippets for styling tables.
The document provides a cheat sheet on HTML table elements including <table>, <tr>, <th>, <td>, <thead>, <tbody>, <tfoot>, <caption>, <col>, <colgroup>. It also gives examples of using these elements and CSS snippets for styling tables.
The element that surrounds all other table Defines a row of cells in the table. Defines a heading cell to label a row or column. elements. scope="row" — for row labels. No other table element can be outside the scope="col" — for column labels. <table>
<td> <thead> <tbody>
Defines a single piece of data in the table—a To group the table rows that define the To group the table rows that account for the cell. headers. main data. Can have many other HTML elements inside, Must have at least one <tr> inside. including other tables. rowspan="…" — allows merging of cells vertically. colspan="…" — allows merging of cells horizontally.
<tfoot> <caption> <col>
To group the table rows that define the footer, To add a visible caption that describes the Non-visible element that defines a column for like totals. purpose of the table. styling. Must have at least one <tr> inside. Really good for accessibility.
<colgroup> Non-visible element that defines a group of columns for accessibility and styling. Examples