This example already contains most of the contents of this article, please cross-reference. View Code "
Definition and Usage
table
Tag defines an HTML table.
Create a table of four table
elements: tr
, th
, ,td
<table>
The entire table to <table>
mark the start, </table>
to mark the end.
<tr>
Table row. Form a line, there are a few tables there are a few lines of tr.
<td>
Table data. A cell of the table, row contains a few of the td, there are several columns in a row.
<th>
Table head. A cell header table, table header.
Additional elements
<tbody>
、<thead>
、<tfoot>
Table structure, if not <thead> <tbody> <tfooter>
, the table will only display finished loading. Plus these, tbody
the content contains rows of display priority, without having to wait after the end of the table display.
Meanwhile, if the table is very long, with the tbody
segment can be displayed part by part.
(Popular understanding table shows the structure of a press block, after the loading table without waiting for the whole display.)
<caption>
Table header
Attributes
border
Table width of the border.
The recommended setting is CSS border styles itself after adding 0.
cellpadding
The spacing between the boundary of the table cell content element (padding).
It is recommended to 0 padding to add their own CSS styles.
cellspacing
The spacing between the cells.
Examples
Use CSS3 to achieve interlaced color table
Examples of code more intuitive view the code "
using CSS3 the :nth-child(n)
form pseudo-interlaced color effects can be achieved class selector.
fillable n odd, even, or any number, representing the odd rows / columns, the even rows / columns or the specified row / column