CSS“颜色"与“字体颜色" [英] CSS "color" vs. "font-color"

查看:84
本文介绍了CSS“颜色"与“字体颜色"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

任何人都知道CSS为什么为文本提供color却没有font-colortext-color吗?

Anyone know why CSS provides color for text, but does not have font-color or text-color?

似乎很违反直觉,有点像text-decoration: underline而不是font-style或与字体有关的东西.

Seems very counter-intuitive, kind of like text-decoration: underline rather than font-style or something related to fonts.

有人知道W3C为什么/如何提出这么多CSS名称吗?

Does anyone know why/how the W3C came up with such a wide array of CSS names like this?

推荐答案

我认为原因之一可能是该颜色应用于除字体之外的其他内容.例如:

I would think that one reason could be that the color is applied to things other than font. For example:

div {
    border: 1px solid;
    color: red;
}

同时产生红色字体颜色和红色边框.

Yields both a red font color and a red border.

或者,就像其他地方所证明的那样,W3C的CSS标准可能完全是落后和荒谬的.

Alternatively, it could just be that the W3C's CSS standards are completely backwards and nonsensical as evidenced elsewhere.

这篇关于CSS“颜色"与“字体颜色"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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