gpt4 book ai didi

css - `currentBackgroundColor` 能否成为有效、有用的 CSS 颜色值关键字?

转载 作者:行者123 更新时间:2023-12-03 16:53:49 26 4
gpt4 key购买 nike

CSS3 defines currentColor作为等效于元素 color 的颜色属性(property)。它有点像 CSS 变量,但基于每个元素。当currentColor在任何 CSS 属性中用作颜色值,它计算为 color应用它的元素的值。

所以,我的问题不是是否有什么 currentBackgroundColor存在——我梳理了CSS3 Color specification并且相当有信心它不会——但它是否可能存在。

借用currentColor定义,我认为 currentBackgroundColor将被定义为:

The value of the ‘background-color’ property. The computed value of the ‘currentBackgroundColor’ keyword is the computed value of the ‘background-color’ property. If the ‘currentBackgroundColor’ keyword is set on the ‘background-color’ property itself, it is treated as ‘background-color: inherit’.



任何人都可以指出我可能没有考虑的任何实现问题吗?

最佳答案

是的,它可以。例如,它可以很容易地创建一段反转颜色的文本,即您可以交换前景色和背景色以突出显示某些内容。

但是,建议将此作为 CSS 功能将与潮流作斗争。曾经有一大堆 CSS 颜色关键字,例如滚动条颜色、标准按钮颜色以及按钮上 3D 阴影的颜色……但它们都在不久前从 CSS 中删除了。

CSS 中有很多有用的东西,但它们并不存在。我个人对 CSS 变量更感兴趣。当它们成为主流时,我们不太可能太担心像这样的颜色关键字

关于css - `currentBackgroundColor` 能否成为有效、有用的 CSS 颜色值关键字?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39561566/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com