当前位置 博文首页 > Champhoenix的博客:CSS表格样式
1.表格标题位置
caption-side:取值;
top 顶部(默认值)
bottom 底部
在table/caption元素中定义。
2.表格边框合并
border-collapse:取值;
seperate 分离(默认值)
collapse 合并
在table元素中定义。
3.表格边框间距
border-spacing:像素值;
在table元素中定义。
例:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title></title>
<style type="text/css">
table,th,td{border:1px solid silver;}
table{
border-spacing: 8px;
border-collapse: collapse;
caption-side: bottom;
}
</style>
</head>
<body>
<table>
<caption>表格标题</caption>
<!--表头-->
<thead>
<tr>
<th>表头单元格1</th>
<th>表头单元格2</th>
</tr>
</thead>
<!--表身-->
<tbody>
<tr>
<td>表行单元格1</td>
<td>表行单元格2</td>
</tr>
<tr>
<td>表行单元格3</td>
<td>表行单元格4</td>
</tr>
</tbody>
<!--表脚-->
<tfoot>
<tr>
<td>表行单元格5</td>
<td>表行单元格6</td>
</tr>
</tfoot>
</table>
</body>
</html>
效果: