cellpadding

Introduction:

介绍:

It is not unknown anymore that now and then we make use of tables in our web page or website, therefore we all are familiar with how to create tables or grids in our website or web page but there are times when we want to adjust the spacing between the cells of the tables or grids and for that to happen there are some properties that should be taken into consideration. There are mainly two properties that help us achieve this task and those properties are cellpadding and cellspacing.

现在我们不时地利用网页或网站中的表格,这已经不为人知了,因此我们都熟悉如何在网站或网页中创建表格或网格,但是有时候我们想要调整间距在表格或网格的单元格之间,为了实现这一点,应该考虑一些属性。 主要有两个属性可以帮助我们完成此任务,而这些属性是cellpadding和cellspacing

Trivia:

琐事:

Before we further move with the properties, let us understand why would we want some spacing and padding between our cells of tables or grids. We often tend to accumulate lots of data into our tables or grids and while doing so, sometimes the tables or grids become too clumsy which in turn gets incomprehensive for users. Therefore, a certain amount of padding and spacing is of utmost importance to segregate the data and by doing so the tables or grids would also appear to be much more neat and comprehensive. It is a good practice to add some spacing or padding whenever we are dealing with a large amount of data. Now let us look at the properties one by one with the help of examples.

在继续使用属性之前,让我们理解为什么我们要在表格或网格的单元格之间留一些间距和填充。 我们经常倾向于将大量数据存储到表或网格中,而这样做有时会使表或网格变得过于笨拙,从而使用户变得不全面。 因此,一定数量的填充和间距对于隔离数据至关重要,因此表格或表格看起来也将更加整洁和全面。 在我们处理大量数据时,最好添加一些间距或填充。 现在,让我们借助示例逐个查看属性。

细胞填充 (Cellpadding)

The cellpadding property in CSS is used to define the space between the cells of the table and its border. It takes only one value that is the length of the padding to be applied in pixels. Sounds pretty easy right? All you gotta do is set up the value of length and you can easily add padding between the cells of your tables or grids.

CSS中cellpadding属性用于定义表格的单元格及其边框之间的空间。 它仅采用一个值,即要应用的填充长度(以像素为单位)。 听起来很容易吧? 您要做的就是设置length的值,您可以轻松地在表格或网格的单元格之间添加填充。

Syntax:

句法:

    <table cellpadding = "length">

Example:

例:

<!DOCTYPE html>
<html>
<head>
<style>
table,
th,
td {border: 2px solid #f40;
}
</style>
</head>
<body>
<p>Table with cellpadding</p>
<table cellpadding="10">
<tr>
<th>Name</th>
<th>Course</th>
<th>Credits</th>
</tr>
<tr>
<td>Anjali</td>
<td>DBMS</td>
<td>3</td>
</tr>
<tr>
<td>Nidhi</td>
<td>Software Eng.</td>
<td>2</td>
</tr>
</table>
</body>
</html>

Output

输出量

In the above example, it is very clearly seen that cellpadding property is used to add padding of 10px is applied to the table cells.

在上面的示例中,可以非常清楚地看到cellpadding属性用于添加10px的填充应用于表格单元格。

单元间距 (Cellspacing)

The cellspacing property in CSS is used to define the space between the cells of the table. It takes only one value that is the length of the padding to be applied in pixels. Just like Cellpadding the Cellspacing property is no big deal when it comes to implication, similar to Cellpadding it also takes up length value to add spacing to your cells in the grids or tables.

CSS中的cellspacing属性用于定义表单元格之间的空间。 它仅采用一个值,即要应用的填充长度(以像素为单位)。 就像Cellpadding一样,Cellspacing属性在含义上没什么大不了的,与Cellpadding一样,它也需要使用长度值来为网格或表格中的单元格增加间距。

Syntax:

句法:

    <table cellspacing = "length">

Example:

例:

<!DOCTYPE html>
<html>
<head>
<style>
table,
th,
td {border: 2px solid #f40;
}
</style>
</head>
<body>
<p>Table with cellspacing</p>
<table cellspacing="20">
<tr>
<th>Name</th>
<th>Course</th>
<th>Credits</th>
</tr>
<tr>
<td>Anjali</td>
<td>DBMS</td>
<td>3</td>
</tr>
<tr>
<td>Nidhi</td>
<td>Software Eng.</td>
<td>2</td>
</tr>
</table>
</body>
</html>

Output

输出量

In the above example, the cellspacing of 20px is applied to the cells of the table and you can also observe how the cells are evenly spaced throughout the table.

在上述例子中,20像素的所述CELLSPACING被施加到表的单元格,并还可以观察如何将细胞均匀分布在整个表隔开。

翻译自: https://www.includehelp.com/code-snippets/set-cellpadding-and-cellspacing-in-css.aspx

cellpadding

cellpadding_在CSS中设置cellpadding和cellspacing相关推荐

  1. 在 CSS 中设置 cellpadding 和 cellspacing?

    问: 在 HTML 表格中,cellpadding 和 cellspacing 可以这样设置: 如何使用 CSS 实现相同的功能? 答1: huntsbot.com – 程序员副业首选,一站式外包任务 ...

  2. 如何在CSS中设置cellpadding和cellspacing

    在HTML表格中,cellpaddingandcellspacing可以这样设置: <table cellspacing="1" cellpadding="1&qu ...

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

    CSS有很多值得学习的地方,本文向大家描述一下用CSS来表示表格的cellpadding和cellspacing方法,希望对你的学习有所帮助. 本文和大家重点讨论一下用CSS来表示表格的cellpad ...

  4. 关于cellpadding cellspacing 属性,无法在css中设置问题

    1. 什么是table 的cellpadding cellspacing 属性 cellpadding:代表单元格边框到内容之间的距离(留白) cellspacing:用来指定表格各单元格之间的空隙. ...

  5. 如何在 CSS 中设置组件在浏览器屏幕水平垂直居中

    如何在 CSS 中设置组件在浏览器屏幕水平垂直居中   在 CSS 中设置组件在浏览器屏幕水平垂直居中可分解为两个问题,一是设置组件在其父组件的水平垂直居中,二是让其父组件铺满整个屏幕.   对于让最 ...

  6. css中设置微软雅黑时,在ie6css中有些样式会失效的解决办法

    最近做专题页面时发现在css中设置{font-family:"微软雅黑";} 时,在ie6中会使一些样式失去作用,或者出现页面变形,尝试着用办双引号去掉或者把 字体设置成font- ...

  7. html图片定位代码怎么写,如何在css中设置插入图片定位

    在做网页开发时,客户给的素材图片通常都是连在一起的,这样做也是为了缩短响应时间.下面就给大家具体说一下 ,如何通过css属性来定位图片. 如何在css中设置插入图片定位 首先设置固定图片的css属性是 ...

  8. html怎么设置字体于字体的间隔,如何在css中设置字体间隔

    如何在css中设置字体间隔 发布时间:2021-05-15 15:39:05 来源:亿速云 阅读:81 作者:Leah 如何在css中设置字体间隔?针对这个问题,这篇文章详细介绍了相对应的分析和解答, ...

  9. 为什么在css中设置了font-family: 微软雅黑没有用

    首先可以用 { font-family: 微软雅黑: } 如果这样不行还可以用: { font-family: "Microsoft YaHei" ! important; } 使 ...

最新文章

  1. 卷积神经网络中十大拍案叫绝的操作
  2. webpack dev server 和 sublime text 配合时需要注意的地方
  3. linux 常用命令整理----链接文件
  4. PMCAFF微课堂 | 测试兄弟CEO揭秘如何提高创初团队的产品质量
  5. 字符串中全角半角之间的转换
  6. mysql 表锁-解锁
  7. 使用Docker部署RabbitMQ集群
  8. iframe高度自适应的6个方法
  9. 【flink】Flink-Cep实现规则动态更新
  10. Checkbox和RadioRadioButton及其实例
  11. 2015-11-30 20:59:08之自力更生
  12. webpack3基础总结
  13. 【九天教您南方cass 9.1】 03 编码法绘制地形图
  14. 报表工具ActiveReports开发实例——物联网智能供水云平台
  15. 使用python和requests爬取世界卫生组织vigiaccess不良反应数据库
  16. 搜索爬行原理_使用Diffbot爬行和搜索整个域
  17. 要来了!国内安卓统一推送标准将于 今年3 月开启测试
  18. ProPresenter 6 for Mac破解版永久激活方法
  19. 易语言编程乱码解决方案
  20. 后端---最全最简单细致的Java接入微信支付接口(Native接入)

热门文章

  1. YOLOv5的Backbone详解
  2. 中级经济师(经济基础知识)第一章 社会主义基本经济制度
  3. 中国农村商业银行产业投资战略及未来发展决策锦衣报告2021-2027年
  4. 20145209刘一阳《网络对抗》实验三:免杀原理与实践
  5. MQ-2烟雾传感器的原理及使用教程
  6. 尾气冒黑烟是什么问题_排气管老是冒黑烟是咋回事?原因在此
  7. Practical Byzantine Fault Tolerance and Proactive Recovery
  8. ###关于k-means的新理解
  9. 期货交易所持仓标准(期货持仓规则)
  10. 信息安全软考 第十章 入侵检测技术原理应用