A brief discussion on HTML table tags

A brief discussion on HTML table tags
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

Recommend

Basic tutorial on controlling Turtlebot3 mobile robot with ROS

Chinese Tutorial https://www.ncnynl.com/category/...

Analyze several common solutions to MySQL exceptions

Table of contents Preface 1. The database name or...

Optimizing the slow query of MySQL aggregate statistics data

Written in front When we operate the database in ...

JS quickly master ES6 class usage

1. How to construct? Let's review the common ...

Solution to overflow:hidden failure in CSS

Cause of failure Today, when I was writing a caro...

MySQL data insertion optimization method concurrent_insert

When a thread executes a DELAYED statement for a ...

Three useful codes to make visitors remember your website

Three useful codes to help visitors remember your...

vue-table implements adding and deleting

This article example shares the specific code for...

SQL implements LeetCode (180. Continuous numbers)

[LeetCode] 180. Consecutive Numbers Write a SQL q...

How to prevent computer slowdown when WIN10 has multiple databases installed

Enable the service when you need it, and disable ...

Detailed explanation of how to connect Java to Mysql version 8.0.18

Regarding the connection method between Java and ...

In-depth explanation of Mysql deadlock viewing and deadlock removal

Preface I encountered a Mysql deadlock problem so...

How to quickly query 10 million records in Mysql

Table of contents Normal paging query How to opti...

Summary of some common configurations and techniques of Nginx

Preface This article lists several common, practi...