关键属性:border-collapse
如果用表格的border="1"属性定义,实际显示的宽度要比1px粗。
所以我直到现在都是定义table的left和top边框,然后定义td的right和bottom边框,这样也用css定义了一个表格的边框。
例子:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>定义</title>
<style>
table{ border-collapse:collapse; }
td{ border:#ccc solid 1px; padding:5px; }
</style>
</head>
<body>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td>1px表格边框</td>
<td>1px表格边框</td>
<td>1px表格边框</td>
</tr>
<tr>
<td>1px表格边框</td>
<td>1px表格边框</td>
<td>1px表格边框</td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
</tr>
</table>
</body>
</html>