 
        . 表格容器
. display 类型是 tabel,inline-block
. 表格常见的结构如下所示
<table>
    <caption></caption>
    <thead>
        <tr>
            <th></th>
        </tr>
    </thead>
    <tbody>
        <tr>
            <td></td>
        </tr>
    </tbody>
    <tfoot>
        <tr>
            <td></td>
        </tr>
    </tfoot> 
<table>
      . 表格的标题/题注/说明
. 如果指定,必须是表格第一个子元素
. 部分属性需要单独设置,如背景色
. 对应的CSS 样式 caption-side 默认为 top,在上部
| 类别 | 说明 | 
|---|---|
| caption-side | top | bottom | 
. 表格的头部
. 需手动添加
. display 类型是 table-row-group
. 表格的主体
. 系统自动添加
. display 类型是 table-row-group
. 表格的尾部
. 需手动添加
. display 类型是 table-row-group
. 表格的行
. display 类型是 table-row,它的子元素只能是 <td> 或 <th>
. <tr> 至少有一个单元格 <td> 有数据;否则空行会被压缩
. 单元格;通常 出现表格标题行/首行,也可以出现在任何位置
. display 类型是 table-cell
. 单元格;表格的普通单元格
. display 类型是 table-cell
| 类别 | 说明 | 
|---|---|
| border | 边框 | 
| width | 宽度 | 
| height | 高度;通常由内容自动撑开 | 
| cellspacing | 单元格间距 | 
| cellpadding | 单元格填充 | 
| align | 水平对齐;默认左对齐 | 
| valign | 垂直对齐;默认居中 middle | 
| colspan | 列合并(向右) | 
| rowspan | 行合并(向下) | 
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}  
table {
  width: 100%;
  border-collapse: collapse;
}
    
<table>
        
  <colgroup>
    <col style="width: 100px;">
    <col style="width: 200px;">
  </colgroup>
  
<table>
      
table td:nth-child(2) {
  width: 20%;
}      
      
table th:first-child {
  width: 30%;
}
     
      线框表格
 
      三线表格
 
      背景表格
 
      斑马纹表格
 
      渐变边框表格
| Name | Gender | Age | |
|---|---|---|---|
| 桂林 | 漓江 | 象鼻山 | 大榕树 | 
| 厦门 | 鼓浪屿 | ||
| 广州 | 小蛮腰 | 珠江 | |
| 海口 | 
| 1 | 2 | 3 | 4 | 
| 5 | 6 | 7 | 8 | 
| 9 | 
| bold | colspan="3" | ||
| rowspan="2" | bold | bold | bold | 
| bold | |||
<table>
    <tr>
        <td>bold</td>
        <td colspan="3">colspan="3"</td>
    </tr>
    <tr>
        <td rowspan="2">rowspan="2"</td>
        <td>bold</td>
        <td>bold</td>
        <td>bold</td>
    </tr>
    <tr>
        <td>bold</td>
    </tr>
</table>
      
table {
    width: 100%;
    border-collapse: collapse;
    border: 4px double #888;
    empty-cells: hide;//无效
}
table th, table td {
    border: 1px solid #888;
}  
    | 1 | 2 | 3 | 4 | 
| 1 | 2 | 3 | 4 | 
| 1 | 2 | 3 | 4 | 
| 1 | 2 | 3 | 4 | 
.radius-tbl {
  border-collapse: separate;
  border-radius: 8px;
  border: 1px solid #666;
}
.radius-tbl td {
  border-bottom: 1px solid var(--main-color-green);
}
.radius-tbl tr:last-child td {
  border: none;
}
    | 1 | 2 | 3 | 4 | 
| 1 | 2 | 3 | 4 | 
| 1 | 2 | 3 | 4 | 
| 1 | 2 | 3 | 4 | 
.radius-tbl-self tbody tr:first-child td:first-child {
  border-top-left-radius: 8px;
  background-color: #f40;
}
.radius-tbl-self tbody tr:first-child td:last-child {
  border-top-right-radius: 8px;
  background-color: #f40;
}
    | sn | name | unit | gender | 
|---|---|---|---|
| 1 | guilin | 54414 | female | 
| 2 | beijing | 75716 | male | 
thead tr {
    display: none;
}
tbody tr {
    display: block;
}
tbody td {
    //这里采用flex,是为了垂直方向对齐内容和其伪元素
    display: flex;
    align-items: center;
    justify-content: space-between;
}    
tbody td::before {
    content: attr(data-label);
}