如何仅水平设置表格中的单元格间距 [英] How to set cellspacing in tables only horizontally
本文介绍了如何仅水平设置表格中的单元格间距的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想为下面写的表格设置样式.
I would like to style the table written below.
<table border="1" cellspacing="10">
<tr>
<th>Month</th>
<th>Savings</th>
</tr>
<tr>
<td>January</td>
<td>$100</td>
</tr>
</table>
问题是 cellpacing 设置了水平和垂直的单元格之间的空间,我希望它只水平设置.有没有办法做到这一点.
The problem is that cellspacing sets the space between cells both horizontaly and verticaly, I would like it to be done only horizontaly. Is there a way to do this.
推荐答案
使用 border-spacing
表格上的 CSS 属性.浏览器支持相当好(主要不包括 IE,包括 IE 7).示例:
Use the border-spacing
CSS property on the table. Browser support is fairly good (excluding mainly IE up to and including IE 7). Example:
table { border-spacing: 10px 0; }
这篇关于如何仅水平设置表格中的单元格间距的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文