A brief analysis of how to use HTML Table

不言
Release: 2018-07-28 11:21:43
Original
1767 people have browsed it

The content of this article is about a brief analysis of how to use HTML Table. It has good reference value. I hope it can help friends in need.

Definition and usage

table tag defines an HTML table.

Four elements to create a table: table, tr, th, td

<table> <p>The entire table starts with the <code><table> tag and ends with the <code> tag.

<tr> <p>Table row. There are several pairs of tr in a row of a table, and there are several rows in a table. </p> <h3><code><td> <p>Table data. A cell of the table contains several pairs of td in one row and several columns in one row. </p> <h3><code><th> <p>Table head. A cell at the head of the table, table header. </p> <h2>Extra elements</h2> <h3><code><tbody>, <code><thead>, <code><tfoot><p>Table structure, if <code><thead> </thead> <tbody> <tfooter> is not added, the table will be displayed after loading. With these additions, <code>tbodythe content containing rows is displayed first, without waiting for the end of the table to be displayed.
At the same time, if the table is very long, use tbody to segment it and display it part by part.
(In layman’s terms, a table can be displayed piece by piece according to the structure, without waiting for the entire table to be loaded.)

<caption></caption>

Table title

Properties

border

The width of the table border.
It is recommended to set it to 0 and then add the border style by yourself using CSS.

cellpadding

The spacing (padding) between the table cell boundary and the cell content.
It is recommended to set it to 0 and then add padding style using CSS by yourself.

cellspacing

The spacing between cells.

Example

Using CSS3 to achieve interlaced table color change

A brief analysis of how to use HTML Table
Using CSS3:nth-child(n) The pseudo-class selector can achieve the effect of changing the color of alternate rows in the table.
n You can fill in odd, even or any number, representing odd rows/columns, even rows/columns or specified rows/columns respectively

Related recommendations:

HTML format And tag introduction

How to briefly describe the basic structure of html (with code)

The above is the detailed content of A brief analysis of how to use HTML Table. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!