HTML表格.docx
《HTML表格.docx》由会员分享,可在线阅读,更多相关《HTML表格.docx(15页珍藏版)》请在冰豆网上搜索。
![HTML表格.docx](https://file1.bdocx.com/fileroot1/2022-11/25/6cf14c43-f141-4fa0-8413-a45a42693225/6cf14c43-f141-4fa0-8413-a45a426932251.gif)
HTML表格
HTML表格
表格由
来定义。每个表格有若干行
每行被分割为若干单元格
td(tabledata)即数据单元格的内容,可以包含文字、文本、图片、列表、段落、表单、水平线、表格等等 row1,cell1 row1,cell2 row2,cell1 row2,cell2 以上表格的源代码如下: [html]viewplaincopyprint? 1. 2. |
3.
row1,cell1 | 4.
row1,cell2 | 5.
6.
7.
row2,cell1 | 8.
row2,cell2 | 9.
10.
row1,cell1 | row1,cell2 |
row2,cell1 | row2,cell2 |
表格的表头
Heading AnotherHeading row1,cell1 row1,cell2 row2,cell1 row2,cell2 源代码如下 [html]viewplaincopyprint? 1. 2. | 3.
Heading | 4.
AnotherHeading | 5.
---|
6.
7.
row1,cell1 | 8.
row1,cell2 | 9.
10.
11.
row2,cell1 | 12.
row2,cell2 | 13.
14.
Heading | AnotherHeading |
---|
row1,cell1 | row1,cell2 |
row2,cell1 | row2,cell2 |
表格中若有空单元格,可在空单元格中加一个空格占位符:
其它实例
1.带有标题的表格
我的标题
100
200
300
400
500
600
[html]viewplaincopyprint?
1.
2.
3.
Thetablehasacaptionandthickframe:
4.
5.
Mycaption6.
7.
100 | 8.
200 | 9.
300 | 10.
11.
12.
400 | 13.
500 | 14.
600 | 15.
16.
17.
18.
Thetablehasacaptionandthickframe:
Mycaption100 | 200 | 300 |
400 | 500 | 600 |
2.跨行或跨列的表格单元格
横跨两列的单元格:
Name
Tel
BillGates
55577854
55577855
横跨两行的单元格:
Name
BillGates
Tel
55577854
[html]viewplaincopyprint?
1.横跨两列的单元格:
2.
3.
Name | 4.Tel
5.
---|
6.
7.
BillGates | 8.
55577854 | 9.
55577855 | 10.
11.
12.横跨两行的单元格
13.
14.
15.
Name | 16.
BillGates | 17.
---|
18.
19.Tel
20.
55577854 | 21.
22.
横跨两列的单元格:
Name | Tel
---|
BillGates | 55577854 | 55577855 |
横跨两行的单元格
Name | BillGates |
---|
Tel
55577854 |
3.表格内的标签
Thisisaparagraph.
Thisisanotherparagraph.
Thisunitcontainsatable
A
B
C
D
Thisunitcontainsalist:
∙Apple
∙Banana
∙Pineapple
Hello
Code:
[html]viewplaincopyprint?
1.
2.
3.
4. Thisisaparagraph. 5. Thisisanotherparagraph. 6. | 7.
Thisunitcontainsatable 8. 9. |
10.
A | 11.
B | 12.
13.
14.
C | 15.
D | 16.
17.
18.
19.
20.
21.
Thisunitcontainsalist: 22. 23. - Apple
24. - Banana
25. - Pineapple
26.
27. | 28.
Hello | 29.
30.
Thisisaparagraph. Thisisanotherparagraph. | Thisunitcontainsatable
|
A | B |
C | D |
Thisunitcontainsalist: | Hello |
4.单元格边距
Nocellpadding:
First
Row
Second
Row
Withcellpadding:
First
Row
Second
Row
[html]viewplaincopyprint?
1.
Nocellpadding:
2.
3.
4.
First | 5.
Row | 6.
7.
8.
Second | 9.
Row | 10.
11.
12.
13.
14.
Withcellpadding:
15.
16.
17.
First | 18.
Row | 19.
20.
21.
Second | 22.
Row | 23.
24.
Nocellpadding:
First | Row |
Second | Row |
Withcellpadding:
First | Row |
Second | Row |
5.单元间隔距(cellspacing)
Withcellspacing:
First
Row
Second
Row
[html]viewplaincopyprint?
1.
Withcellspacing:
2.
3.
4.
First | 5.
Row | 6.
7.
8.
Second | 9.
Row | 10.
11.
Withcellspacing:
First | Row |
Second | Row |
6.向表格添加背景颜色或图像
7.向表格单元格添加背景颜色或图像
[html]viewplaincopyprint?
1.
2.
3.First
4.
Row | 5.
6.
7.Second
8.
Row | 9.
10.
First
Row |
Second
Row |
8.在表格单元中排列内容
Consumeditem...
January
February
Clothes
$241.10
$50.20
Makeup
$30.00
$44.45
Food
$730.40
$650.00
Total
$1001.50
$744.65
[html]viewplaincopyprint?
1.
2.
3.Consumeditem...
4.January
5.February
6.
|
7.
8.Clothes
9.$241.10
10.$50.20
11.
|
12.
13.Makeup
14.$30.00
15.$44.45
16.
|
17.
18.Food
19.$730.40
20.$650.00
21.
|
22.
23.Total
24.$1001.50
25.$744.65
26.
|
27.
Consumeditem...
January
February
|
Clothes
$241.10
$50.20
|
Makeup
$30.00
$44.45
|
Food
$730.40
$650.00
|
Total
$1001.50
$744.65
|
9.Frame属性
Comment:
frame属性无法在InternetExplore中正确的显示
Tablewithframe="box":
Month
Savings
January
$100
Tablewithframe="above":
Month
Savings
January
$100
Tablewithframe="below":
Month
Savings
January
$100
Tablewithframe="hsides":
Month
Savings
January
$100
Tablewithframe="vsides":
Month
Savings
January
$100
[html]viewplaincopyprint?
1.
Tablewithframe="below":
2.
3.
4.
Month | 5.
Savings | 6.
---|
7.
8.
January | 9.
$100 | 10.
11.