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

1. 什么是table 的cellpadding cellspacing 属性

cellpadding:代表单元格边框到内容之间的距离(留白)

cellspacing:用来指定表格各单元格之间的空隙。此属性的参数值是数字,表示单元格间隙所占的像素点数。
.
.

2. 为啥html中,table 的cellpadding cellspacing 属性,无法在css中设置

cus:
cellpadding,cellspacing都是废弃的属性了,早已不推荐使用,最新的html5里已经彻底去掉了这些表现型的属性。

那咋办:( td 的 margin 和 padding 不能解决)
用 css 的 border 解决

table {
	border-collapse: collapse;  //切记是 <table> 的属性,而非 <td> 的.
}

border-collapse中的 collapseseparate 值,定义为collapse时,边框会重叠在一起。定义为separate时单元格边框之间会有间隙。不定义时默认为separate

发布了108 篇原创文章 · 获赞 114 · 访问量 8581

猜你喜欢

转载自blog.csdn.net/weixin_45773503/article/details/104346419
今日推荐