微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

html – 为什么不允许使用样式表列?

W3 specifies表格列(包括< col>元素)只允许四个CSS规则 – 边框,背景,宽度和可见性。

有人知道这个决定背后的原因吗?如果你可以拥有边框和背景,为什么不是字体和颜色?

解决方法

Ian Hixie在这里详细解释: The mystery of why only four properties apply to table columns.相关报价:

The colour of text is dependent on the ‘color’ property of its element. Unless specified,the ‘color’ property (basically) defaults to ‘inherit’,which means “take the value of the parent element”.

So for some text in a cell,the colour is determined by the ‘color’ property of the cell,which is taken from the row,which is taken from the table,which is taken from the table’s parent,and so on.

What about the column? Well,the column isn’t one of the cell’s ancestors,so it never gets a look-in! And therein lies the problem.

原文地址:https://www.jb51.cc/html/232831.html

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐