答案是仍然使用 HTML 中 table 的 cellspacing 属性。如下:
<table cellspacing="0">
    ...
</table>

除此之外理论上在 CSS2 中,可以设定下列两个样式的组合来达到效果。
1. border-collapse: separate; (独立边框,不合并)
2. border-spacing: length || length;

这里的长度 length 如果指定一个,那么作用于上下左右间隔;如果指定两个,第一个指横向间距,第二个指纵向间距。
border-spacing 必须在 border-collapse 样式设置为 separate 的时候才起作用。

但是 border-spacing 属性的支持不好。在 IE6 里也看不到效果,而 Mozilla 可以正常显示。所以处理间距最好的方式还是使用 <table cellspacing=".."> 这种写法。

下列文档可分别加载到 Mozilla 和 IE 中测试效果:
采用 web standard 开发时如何设定表格的单元格间距<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
采用 web standard 开发时如何设定表格的单元格间距        "http://www.w3.org/TR/html4/strict.dtd"
>
采用 web standard 开发时如何设定表格的单元格间距
<html>
采用 web standard 开发时如何设定表格的单元格间距
<head>
采用 web standard 开发时如何设定表格的单元格间距
<meta http-equiv="Content-Type" content="text/html;charset=gb2312">
采用 web standard 开发时如何设定表格的单元格间距
<title> New Document </title>
采用 web standard 开发时如何设定表格的单元格间距
<meta name="Generator" content="EditPlus">
采用 web standard 开发时如何设定表格的单元格间距
<meta name="Author" content="Roger Chen">
采用 web standard 开发时如何设定表格的单元格间距
<meta name="keywords" content="">
采用 web standard 开发时如何设定表格的单元格间距
<meta name="description" content="">



采用 web standard 开发时如何设定表格的单元格间距
</style>
采用 web standard 开发时如何设定表格的单元格间距
</head>
采用 web standard 开发时如何设定表格的单元格间距
<body>
采用 web standard 开发时如何设定表格的单元格间距
<table id="board">
采用 web standard 开发时如何设定表格的单元格间距    
<tr>
采用 web standard 开发时如何设定表格的单元格间距        
<td>1</td>
采用 web standard 开发时如何设定表格的单元格间距        
<td>2</td>
采用 web standard 开发时如何设定表格的单元格间距    
</tr>
采用 web standard 开发时如何设定表格的单元格间距
</table>
采用 web standard 开发时如何设定表格的单元格间距
</body>
采用 web standard 开发时如何设定表格的单元格间距
</html>

IE 中的效果:采用 web standard 开发时如何设定表格的单元格间距
Mozilla 中的效果:采用 web standard 开发时如何设定表格的单元格间距

相关文章:

  • 2021-12-26
  • 2022-01-20
  • 2021-06-20
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-03-02
  • 2021-12-26
猜你喜欢
  • 2021-11-20
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-01-04
  • 2021-09-29
  • 2022-12-23
相关资源
相似解决方案