互联网技术 · 2024年2月15日

Html表格属性的总结

Html中table的属性:

border= “1” :给整个表格(包括表格及每一个单元格)加上1像素的黑色边框,

其等同于css中的: table,table tr th, table tr td { border:1px solid #0094ff; }

cellpadding=“0” :单元格边距等于0,其默认值为1px,

其等同于css中的:{padding:0;}

cellspacing=”0″ :单元格间距等于0,其默认值为2px,

其等同于css中的:border-collapse: collapse(边框合并),但又不完全相同,cellspacing仅间距,而border-collapse使临近的边线合并成一条边线,也就避免了cellspacing中边线重合造成边线加粗的问题。所以在这里不提倡使用html属性设置表格边框时将cellspacing设置为0,,如果你希望他等于0,更提倡使用css样式属性的方法去设置表格的边框,并使用border-collapse: collapse去合并边线,而不是将cellspacing设置为0,造成重合边线加粗的问题。

文章来源:田珊珊个人博客

来源地址:http://www.tianshan277.com/722.html

OpenMagic API

Need more than content? Move into the product flow.

If you are here for model access, pricing, developer docs, or the future API console, the dedicated product path now lives on api.openmagic.ai.

登录免费注册