w3school手册:http://www.w3schools.com/tags/att_table_cellspacing.asp

一直以来都发现自己对cellpadding&cellspacing的定义是不够清楚,所以很自然对padding&margin的定义也不是那么的清楚。可是,我对于padding&margin的理解还是比cellpadding&cellspacing深入一点的,毕竟,padding&margin只不是用来对同一个物体自己本身的描述,padding(一个块元素的内边距,就是该元素中的内容到该元素内侧边框的距离),margin(一个块元素的外边距,就是该元素自己本身的边框到父元素边框的距离)。

默认情况下,表格中的单元格是相互挤在在一起的。为了在你表格中的单元格添加一些空间的话,可以使用cellpadding&cellspacing。

cellspacing —— 控制着两个单元格之间的距离,尽管是没有官方默认值的,浏览器通常却会使用一个默认值为2,即在浏览器中,cellspacing的值就是会默认为2。

cellpadding —— 控制单元格中内容与单元格内四周之间的距离,默认值是1。通常情况下,cellpadding比cellspacing可以更加的有效扩大表格内容。

原文链接:http://www.htmlcodetutorial.com/tables/index_famsupp_29.html

How to set cellspacing and cellpadding in css ?

http://stackoverflow.com/questions/339923/how-to-set-cellpadding-and-cellspacing-in-css

For controlling "cellpadding" in CSS, you can simply use padding on table cells. E.g. for 10px of "cellpadding":

td {
padding: 10px;
}

For "cellspacing", you can apply the border-spacing CSS property to your table. E.g. for 10px of "cellspacing":

table {
border-spacing: 10px;
border-collapse: separate;
}

This property will even allow separate horizontal and vertical spacing, something you couldn't do with old-school "cellspacing".

Issues in IE <= 7

This will work in almost all popular browsers except for Internet Explorer up through Internet Explorer 7, where you're almost out of luck. I say "almost" because these browsers still support the border-collapseproperty, which merges the borders of adjoining table cells. If you're trying to eliminate cellspacing (that is, cellspacing="0") then border-collapse:collapse should have the same effect: no space between table cells. This support is buggy, though, as it does not override an existing cellspacing HTML attribute on the table element.

In short: for non-Internet Explorer 5-7 browsers, border-spacing handles you. For Internet Explorer, if your situation is just right (you want 0 cellspacing and your table doesn't have it defined already), you can use border-collapse:collapse.

table {
border-spacing: 0;
border-collapse: collapse;
}

[翻译][HTML]CELLPADDING and CELLSPACING的更多相关文章

  1. CSS中表示cellpadding和cellspacing的方法

    本文和大家重点讨论一下用CSS来表示表格的cellpadding和cellspacing方法,表格的cellpadding和cellspacing我们经常会用一定的方式来清除默认样式,请看下文详细介绍 ...

  2. HTML cellpadding与cellspacing属性

    单元格(cell) -- 表格的内容 单元格边距(表格填充)(cellpadding) -- 代表单元格外面的一个距离,用于隔开单元格与单元格空间 单元格间距(表格间距)(cellspacing) - ...

  3. 在html5中不支持<table>的cellpadding 和 cellspacing ; 2) 如何用css实现 cellpadding, cellspacing ; 3) tr , th 是 有 border, 没有 padding 的.

    1.初始: <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF ...

  4. cellspacing与cellpadding

    此文引用自cellpadding和cellspacing属性来控制表格边框的间距. 作者:nestea 巢(cell) -- 表格的内容 巢补白(表格填充)(cellpadding) -- 代表巢外面 ...

  5. CSS控制 table 的 cellpadding,cellspacing

    CSS 常规解决办法: 表格的 cellpadding 和 cellspacing 我们经常会用如下的方式来清除默认样式: <table cellspacing="0" ce ...

  6. 翻译:HTML5与HTML4的区别

    本文选译自:W3C Working Group Note: HTML5 Differences from HTML4. 解释一下W3C Working Group Note,作为"工作组笔记 ...

  7. [译]MVC网站教程(四):MVC4网站中集成jqGrid表格插件(系列完结)

    目录 1.   介绍 2.   软件环境 3.   在运行示例代码之前(源代码 + 示例登陆帐号) 4.         jqGrid和AJAX 5.         GridSettings 6.  ...

  8. 一篇UI规范文件

    一篇UI规范文件 这是一个UI模板规范,在做B/S版应用程序时比较适用,其实这样的东西算不上什么正规的规范,只是为了适应我们现在面对的开发环境和组织流程做的一些权宜的努力,和解决了一些与程序沟通和接口 ...

  9. datatables增删改查的实现

    学习可参考:http://www.guoxk.com/node/jquery-datatables http://yuemeiqing2008-163-com.iteye.com/blog/20069 ...

随机推荐

  1. websoket

    http://blog.csdn.net/xueling022/article/details/52902358

  2. Hibernate使用固定值关联表

    假设表A与表B需要进行一对一关联,表A的a1字段等于表B的a1字段,同时表B中的b2字段需要为某一固定值,可采取如下方式配置: public class A { private String a; @ ...

  3. jquery 使用方法(转载)

    原文地址:http://www.cnblogs.com/Chenfengtao/archive/2012/01/12/2320490.html jQuery是目前使用最广泛的javascript函数库 ...

  4. ROI

    1.ROI简介 ROI(region of interest),感兴趣区域.机器视觉.图像处理中,从被处理的图像以方框.圆.椭圆. 不规则多边形等方式勾勒出需要处理的区域,称为感兴趣区域,ROI.在H ...

  5. goim源码分析与二次开发-comet分析一

    因为要完成一个聊天的项目,所以借鉴了goim,第一篇分析打算半原版,先摘抄http://www.jianshu.com/p/8bd96a9a473d他的一些理解,写这些还是为了让自己更好的理解这个项目 ...

  6. Linux-——grep

    概念介绍 grep (global search regular expression(RE) and print out the line,全面搜索正则表达式并把行打印出来)是一种强大的文本搜索工具 ...

  7. JTemplate学习(二)

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DT ...

  8. win7安装qt5 纯记录 水文

    去qt官网下载http://www.qt.io/看见download就点进去看看吧 目前的下载地址路径是http://www.qt.io/download-open-source选择Offline I ...

  9. HRegionServer异常下线问题

    ==版本== Hadoop:2.7.1 HBase:1.2.1 Zookeeper:3.4.6 ==现象== HBase集群启动一段时间之后,一部分HRegionServer会异常下线重启(用syst ...

  10. with as 创建临时表,解决union all多个时出现内存出错的问题

    with t(content_id, emp_id) as (VALUES('002', 416),('003', 416))SELECT * FROM t;