html中,table 的cellpadding cellspacing 属性,无法在css中设置?

如题所述

可以在css中设置的。

cellpadding属性可以使用css中的内边距属性代替。

border-collapse:collapse; 

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

cellpadding 属性:规定单元边沿与其内容之间的空白。

语法:

<body cellpadding="value">

cellspacing 属性:规定单元格之间的空间。

语法:

<body cellspacing="value">

扩展资料:

具体实现代码:

css部分:

<style type="text/css">

table{ border-collapse:collapse; border:solid 1px Black; }

table td{ width:50px; height:20px;  border:solid 1px Black; padding:5px;}

</style>

html部分:

<table>

<tr>

<td></td>

<td></td>

</tr>

<tr>

<td></td>

<td></td>

</tr>

</table>

温馨提示:答案为网友推荐,仅供参考
相似回答