如何在表格中水平设置单元格间距 [英] How to set cellspacing in tables only horizontally

查看:158
本文介绍了如何在表格中水平设置单元格间距的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想为下面写的表格样式。

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>

问题是cellspacing设置了horizo​​ntally和verticaly之间的单元格空间,我想它只做水平。有办法做到这一点。

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 。浏览器支持是相当不错的(不包括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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆