Table is a tag that has been used by everyone for a long time. It is still used today. However, due to the current website reconstruction, it is recommended that you do not use tables for layout. Many friends mistakenly think that using tables is the so-called It is not standard, but it is not the case. The table is an important element.
Table tags mainly include tags table, caption, th, tr, td, thead, tfoot, tbody, col, and colgroup. The introduction of each is as follows:
<table>
The table tag defines a table. Inside the <table> tag, you can place table titles, table rows, table columns, table cells, and other tables.
<caption>
The caption element defines a table title. The caption tag must immediately follow the table tag. You can define only one title per table. Usually the title will be centered above the table.
<th>
Define the header cell in the table. Text inside this th element will usually be rendered bold.
<tr>
Define a row in the table.
<td>
Defines a cell in the table.
<thead>
Define the header of the table.
The thead, tfoot, and tbody elements give you the ability to group rows in a table. When you create a table, you probably want to have a header row, some rows with data, and a total row at the bottom. This division gives the browser the ability to support table body scrolling independently of table headers and footers. When long tables are printed, the table header and footer can be printed on each page that contains the table data.
<tbody>
Define a table body (text).
Using the <tbody> tag, the table can be divided into a separate section. The <tbody> tag can group one or several rows in a table.
Although you may want to include one, or even two or more <tbody> tags in the table, we recommend that there be no <tbody> tags in the table.
Among the <tbody> tags, only the <tr> tag can define table rows. And once defined, a <tbody> tag is an independent part of the table. For example, you cannot span from one <tbody> to another <tbody>.
The thead, tfoot, and tbody elements give you the ability to group rows in a table. When you create a table, you probably want to have a header row, some rows with data, and a total row at the bottom. This division gives the browser the ability to support table body scrolling independently of table headers and footers. When long tables are printed, the table header and footer can be printed on each page that contains the table data.
<tfoot>
Define the footer (footnote) of the table.
The thead, tfoot, and tbody elements give you the ability to group rows in a table. When you create a table, you probably want to have a header row, some rows with data, and a total row at the bottom. This division gives the browser the ability to support table body scrolling independently of table headers and footers. When long tables are printed, the table header and footer can be printed on each page that contains the table data.
<col>
Defines attribute values for one or more columns in a table. You can use this property only in tables or colgroups.
<colgroup>
Define the grouping of table columns. This element allows you to group columns for formatting purposes. This element is only valid inside the <table> tag.
There are two ways to use the <colgroup> tag: one is to simply define several identical columns, and the other is to combine several different columns.