表格基本格式
<table>(表格开始)
<tr>(表格行)
<th>...</th>(表格标题)
</tr>
<tr>
<td>...</td>(表格列)
</tr>
</table>(表格结束)
<table>表格的属性:
(例:<table border=”1”></table>)
属性名称 | 属性值 | 说明 |
---|---|---|
border | 像素px | 设置表格的外边线 |
cellspacing | 像素px/百分数% | 设置储存格框线宽度 |
cellpadding | 像素px/百分数% | 设置数据与框线的距离 |
width | 像素px/百分数% | 设置表格宽度 |
height | 像素px/百分数% | 设置表格高度 |
align | left | 表格左对齐,默认 |
align | center | 表格居中对齐 |
align | right | 表格右对齐 |
bgcolor | 英文(red 红色)/十六进制(如:#f00000 红色) | 表格的背景颜色 |
background | URL(图片路径) | 表格的背景图片 |
bordercolor | 英文(red 红色)/十六进制(如:#f00000 红色) | 表格边框颜色 |
bordercolorlight | 英文(red 红色)/十六进制(如:#f00000 红色) | 表格边框的亮色(有的浏览器不识别) |
bordercolordark | 英文(red 红色)/十六进制(如:#f00000 红色) | 表格边框的暗色(有的浏览器不识别) |
table表格
<tr><td><th>标签的属性
(例:<td align=”center”></td>)
属性名称 | 属性值 | 说明 |
---|---|---|
width | 像素px/百分数% | 设置宽度 |
height | 像素px/百分数% | 设置高度 |
bgcolor | 英文(red 红色)/十六进制(如:#f00000 红色) | 数据栏的颜色设置 |
align | left | 数据靠左对齐,默认 |
align | center | 数据居中对齐 |
align | right | 数据靠右对齐 |
valign | top | 数据靠上对齐 |
valign | midlle | 数据靠中对齐 |
valign | bottom | 数据靠下对齐 |
nowrap | nowrap | 不在单元格中换行 |
table表格
表格的拆分与合并单元格
属性名称 | 属性值 | 说明 |
---|---|---|
colspan | 数字(1,2...) | 行合并 |
rowspan | 数字(1,2...) | 列合并 |
表格的拆分与合并单元格
表格的标题
//表格外的标题
<table>
<caption>...</caption>
</table>
//表格里的标题
<table>
<tr>
<th></th>
</tr>
</table>
属性名称 | 属性值 | 说明 |
---|---|---|
align | top | 标题在表格上方,默认 |
align | bottom | 标题在表格下方 |
表格的标题