[翻译][HTML]CELLPADDING and CELLSPACING
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-collapse
property, 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的更多相关文章
- CSS中表示cellpadding和cellspacing的方法
本文和大家重点讨论一下用CSS来表示表格的cellpadding和cellspacing方法,表格的cellpadding和cellspacing我们经常会用一定的方式来清除默认样式,请看下文详细介绍 ...
- HTML cellpadding与cellspacing属性
单元格(cell) -- 表格的内容 单元格边距(表格填充)(cellpadding) -- 代表单元格外面的一个距离,用于隔开单元格与单元格空间 单元格间距(表格间距)(cellspacing) - ...
- 在html5中不支持<table>的cellpadding 和 cellspacing ; 2) 如何用css实现 cellpadding, cellspacing ; 3) tr , th 是 有 border, 没有 padding 的.
1.初始: <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF ...
- cellspacing与cellpadding
此文引用自cellpadding和cellspacing属性来控制表格边框的间距. 作者:nestea 巢(cell) -- 表格的内容 巢补白(表格填充)(cellpadding) -- 代表巢外面 ...
- CSS控制 table 的 cellpadding,cellspacing
CSS 常规解决办法: 表格的 cellpadding 和 cellspacing 我们经常会用如下的方式来清除默认样式: <table cellspacing="0" ce ...
- 翻译:HTML5与HTML4的区别
本文选译自:W3C Working Group Note: HTML5 Differences from HTML4. 解释一下W3C Working Group Note,作为"工作组笔记 ...
- [译]MVC网站教程(四):MVC4网站中集成jqGrid表格插件(系列完结)
目录 1. 介绍 2. 软件环境 3. 在运行示例代码之前(源代码 + 示例登陆帐号) 4. jqGrid和AJAX 5. GridSettings 6. ...
- 一篇UI规范文件
一篇UI规范文件 这是一个UI模板规范,在做B/S版应用程序时比较适用,其实这样的东西算不上什么正规的规范,只是为了适应我们现在面对的开发环境和组织流程做的一些权宜的努力,和解决了一些与程序沟通和接口 ...
- datatables增删改查的实现
学习可参考:http://www.guoxk.com/node/jquery-datatables http://yuemeiqing2008-163-com.iteye.com/blog/20069 ...
随机推荐
- php获取微信用户信息(没测试过)
<?php /** * 通过$appid.$appsecret获得基础支持的接口唯一凭证access_token,返回值为array类型 */ function get_access_token ...
- mysql数据库的卸载
1.控制面板 程序和功能 卸载MySQL相关 2.卸载MySQL的安装目录 与储存目录 3.删除C盘下隐藏MySQL文件:组织-----文件夹和搜索选项-----------查看------ ...
- 阿里云SSL证书tomcat配置
1. SSL证书申请 登录阿里云控制台,查看购买域名中有SSL证书的申请,ssl证书申请中有单域名的申请,配置要申请的域名信息(注意:一个域名下,一次只能添加一个证书,最多申请3个免费证书用于测试), ...
- jq闭包
var jy = jQuery.noConflict(); (function($){ //里面跟jq的所有代码 })(jy)
- 用SQL2000还原bak文件
1.右击SQL Server 2000实例下的“数据库”文件夹.就是master等数据库上一级的那个图标.选择“所有任务”,“还原数据库” 2.在“还原为数据库”中填上你希望恢 复的数据库名字.这个名 ...
- Golang之定时器,recover
滴答滴答……定时器的使用 package main import ( "fmt" "time" ) //定时器的使用 func main() { t := ti ...
- Java中弹出对话框中的几种方式
1.显示一个错误对话框,该对话框显示的 message 为 'alert': JOptionPane.showMessageDialog(null, "alert", " ...
- 02 Maven 入门使用
Maven 入门使用 1. Maven 项目工程目录约定 Project |-src | |-main | | |-java -- 存放项目的 .java 文件 | | |-resources -- ...
- PHP 用 ZipArchive 打包指定文件到zip供用户下载
Ubuntu需安装zlib sudo apt-get install ruby sudo apt-get install zlib1g zlib1g.dev Windows需开启php_zip.d ...
- 100 floors 2 eggs
https://github.com/Premiumlab/Python-for-Algorithms--Data-Structures--and-Interviews/blob/master/Moc ...