XHTML tutorial: application of table Tags

Time:2022-6-8

Table is an awkward tag in XHTML. This section is just for understanding
Before the popularity of CSS, table was widely used for positioning. In XHTML, table is not recommended for positioning. W3C hopes that CSS can replace <table> in positioning. However, in fact, because the use of CSS layout often requires a lot of handwritten code (common web design software such as Dreamweaver can not perfectly support the display of DIV), <table> is still used by many websites for home page layout. For example, Google’s more products page uses table to locate. However, I personally recommend that you start using CSS to locate web pages, because this is the direction of web development. Of course, replacing table with CSS in the early stage may cause you a lot of trouble.
In XHTML, the tag used to create a table is <table>. When writing code, we should first use the <tr> tag to divide the table into rows, and then use the <td> tag to divide each row into cells. It is very difficult and inefficient to create a table with completely handwritten code. Making a table in a web page making software is as simple as word. You only need to select simple attributes such as rows and columns. However, we may encounter the possibility that the automatically generated table does not meet the requirements and needs to be adjusted in the code mode. Therefore, we still need to understand the specific writing of XHTML table tags.
The <table> tag can have a border attribute. If you do not set the value of the border property, the browser will not display the border of the table by default.
Let’s create a label with four rows and two columns. The code is as follows:
<table border=”1″>
<tr>
<td>A grid</td>
<td>A grid</td>
</tr>
<tr>
<td>A grid</td>
<td>A grid</td>
</tr>
<tr>
<td>A grid</td>
<td>A grid</td>
</tr>
<tr>
<td>A grid</td>
<td>A grid</td>
</tr>
</table>



The display results are as follows: note the above code. There are four pairs of <tr>, corresponding to the following four lines. There are two <td> cells in each <tr> (row). So it becomes a table with 4 rows and 2 columns.
A grid
Such a table is sufficient to list information such as data, but the table used to locate is usually more complex. Again, we don’t recommend using table to locate, so here we just briefly introduce <table>.