Markdown绘制表格
正常markdown语法:
text
1
2
3
4
5
6
| 表头 | 表头 | 表头 |
| -------- | -------- | -------- |
| 行1,列1 | 行1,列2 | 行1,列3 |
| 行2,列1 | 行2,列2 | 行2,列3 |
| 行3,列1 | 行3,列2 | 行3,列3 |
效果图:
| 表头 | 表头 | 表头 |
|---|---|---|
| 行1,列1 | 行1,列2 | 行1,列3 |
| 行2,列1 | 行2,列2 | 行2,列3 |
| 行3,列1 | 行3,列2 | 行3,列3 |
text
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<h4>单元格跨行跨列:</h4> <!--标题-->
<table border="1" width="500px" cellspacing="10">
<tr>
<th align="left">表头(左对齐)</th>
<th align="center">表头(居中)</th>
<th align="right">表头(右对齐)</th>
</tr>
<tr>
<td>行1,列1</td>
<td>行1,列2</td>
<td>行1,列3</td>
</tr>
<tr>
<td colspan="2" align="center">合并行单元格</td>
<td>行2,列3</td>
</tr>
<tr>
<td rowspan="2" align="center">合并列单元格</td>
<td>行3,列2</td>
<td>行3,列3</td>
</tr>
<tr>
<td>行4,列2</th>
<td>行4,列3</td>
</tr>
</table>
<!--在表格td中,有两个属性控制居中显示
align——表示左右居中——left,center,right
valign——控制上下居中——left,center,right
width——控制单元格宽度,单位像素
cellspacing——单元格之间的间隔,单位像素
-->
效果图:
单元格跨行跨列:
| 表头(左对齐) | 表头(居中) | 表头(右对齐) |
|---|---|---|
| 行1,列1 | 行1,列2 | 行1,列3 |
| 合并行单元格 | 行2,列3 | |
| 合并列单元格 | 行3,列2 | 行3,列3 |
| 行4,列2 | 行4,列2 | |