Update index.md (#28398)

Add some details about table, and the css property: border.
This commit is contained in:
yulixue
2019-06-25 16:22:17 +08:00
committed by Kristofer Koishigawa
parent 0fb5d35e14
commit 6167811c09

View File

@ -2,20 +2,26 @@
title: Tables
localeTitle: 表格
---
### 定义HTML表
### 定义HTML表
HTML中的表格由<table>标签定义
表格中的行由<tr>定义。每一行中可以为表头或者数据。
* 表头由<tr>标签定义。表头默认为加粗居中。
* 表格数据/单元格用<td>标签定义
`<table>`定义HTML表格
表格由行`<tr>`组成,行由单元格组成。单元格可以分为标题单元格`<th>`和数据单元格`<td>`。默认情况下,标题单元格为粗体且居中。
更复杂的HTML表格还可能包含`<caption>` `<col>` `<colgroup>` `<thead>` `<tfoot>``<tbody>`元素。
#### 给表格添加边框
表格的默认格式是没有边框的。
添加边框需要用到CSS的`border`属性:
```css
table, th, td {
border: 1px solid black;
}
```
### 简单的表格示例
```html
@ -80,10 +86,11 @@ Item Amount
Apple 10
Peach 15
Watermelon 3
| 项目 | 数量 |
|----|----|
| 苹果 | 10 |
| 桃子 | 15 |
| 西瓜 | 3 |
#### 更多信息: