Mainly discuss its structure and some important properties. I will introduce it in a slowly improving way. 1) The basic structure is as follows: <tr> represents a row in a table, and <td> represents a column in a row. When we talk about a column, we can actually think of it as a cell in Word. <th> is actually a cell, but it is used as a table header. Semantically speaking: <td> indicates the data unit in the table, and <th> indicates the title of a column or a row in the table. Copy code The code is as follows:<table> <tr><th></th></tr> <tr><td><td></tr> </table> 2) A title may be a row title or a column title. How to distinguish them? Need to use the scope attribute scope=row/col. Copy code The code is as follows:<table> <tr><th scope="col"></th></tr> <tr><td><td></tr> </table> 3) The table also has its own title <caption> Copy code The code is as follows:<table> <caption>Table title</caption> <tr><th scope="col"></th></tr> <tr><td><td></tr> </table> 4) Add summary attribute to the table Copy code The code is as follows:<table summary="This is a table summary"> <caption>Table title</caption> <tr><th scope="col"></th></tr> <tr><td><td></tr> </table> 5) Table border model and cell default padding. There are two display modes for table borders: separated and merged. border-collapse: separate/collapse The default style of IE6 is separate and looks like three-dimensional. In reality, each cell has its own independent border. Merge means sharing borders. table { border-collapse: collapse; } By default, there is white space between cells. You can use border-spacing to control it, but it is rarely used because IE6 does not support it. IE6 Use cellspacing. Copy code The code is as follows:<table summary="This is a table content summary" cellspacing="0"> <caption>Table title</caption> <tr><th scope="col"></th></tr> <tr><td><td></tr> </table> 6) Add some rows and columns. And add an id to each <th>. Copy code The code is as follows:<table summary="This is a table content summary" cellspacing="0"> <caption>Table title</caption> <tr> <th scope="col" id="name">Name</th> <th scope="col" id="address">Address</th> <th scope="col" id="databirthday">Date of Birth</th> </tr> <tr> <td>ewee<td> <td>hubei<td> <td>19870102<td> </tr> <tr> <td>rewe<td> <td>wuhan<td> <td>419880103<td> </tr> <tr> <td>ertww<td> <td>yichang<td> <td>19870205<td> </tr> </table> 7) Divide the table logically <thead><tbody><tfoot>. After dividing the table into multiple logical areas, you can use CSS to better control the performance. Copy code The code is as follows:<table summary="This is a table content summary" cellspacing="0"> <caption>Table title</caption> <thead> <tr> <th scope="col" id="name">Name</th> <th scope="col" id="address">Address</th> <th scope="col" id="databirthday">Date of Birth</th> </tr> </thead> <tbody> <tr> <td>ewee<td> <td>hubei<td> <td>19870102<td> </tr> <tr> <td>rewe<td> <td>wuhan<td> <td>419880103<td> </tr> <tr> <td>ertww<td> <td>yichang<td> <td>19870205<td> </tr> <tbody> </table> This essay of mine only briefly talks about the structure of the table. I hope it is useful. |
<<: How to obtain root permissions in a docker container
>>: Sharing an idea of building a master-slave system for a large MySQL database
Chinese Tutorial https://www.ncnynl.com/category/...
Table of contents Preface 1. The database name or...
Written in front When we operate the database in ...
1. How to construct? Let's review the common ...
Cause of failure Today, when I was writing a caro...
When a thread executes a DELAYED statement for a ...
Three useful codes to help visitors remember your...
This article example shares the specific code for...
[LeetCode] 180. Consecutive Numbers Write a SQL q...
Preface This article mainly introduces the soluti...
Enable the service when you need it, and disable ...
Regarding the connection method between Java and ...
Preface I encountered a Mysql deadlock problem so...
Table of contents Normal paging query How to opti...
Preface This article lists several common, practi...