为什么 cellpacing 和 cellpadding 不是 CSS 样式 [英] Why are cellspacing and cellpadding not CSS styles

查看:27
本文介绍了为什么 cellpacing 和 cellpadding 不是 CSS 样式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不知道为什么这让我如此困扰,但是当我创建网站时,我总是尝试使用 CSS 来完成所有样式.然而,当我处理表格时,我总是必须记住要做的一件事是添加 cellpacing="0" 和 cellpadding="0"

I don't know why this bothers me so much, but when I create websites, I always try to do all my styling with CSS. However one thing I always have to remember to do when I'm working with tables is add cellspacing="0" and cellpadding="0"

为什么没有一个 CSS 属性来覆盖这些过时的 HTML 4 属性?

Why is there not a CSS property to override these antiquated HTML 4 attributes?

推荐答案

Cellspacing :

table { border-collapse: collapse; }

至于cellpadding,你可以做

table tr td, table tr th { padding: 0; }

这篇关于为什么 cellpacing 和 cellpadding 不是 CSS 样式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆