是否有一个“box-shadow-color”属性? [英] Is there a 'box-shadow-color' property?

查看:151
本文介绍了是否有一个“box-shadow-color”属性?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下CSS:

box-shadow: inset 0px 0px 2px #a00;

现在我试图提取这种颜色,使页面颜色变得可肤。有什么办法这样做吗?只需删除颜色,然后再次使用相同的键即可覆盖原始规则。

Now I am trying to extract that color to make the page colors 'skinnable'. Is there any way of doing this? Simply removing the color, and then using the same key again later overwrites the original rule.

似乎没有 box-shadow -color ,至少Google没有任何回应。

There doesn't seem to be a box-shadow-color, at least Google turns nothing up.

推荐答案

否:

http://www.w3 .org / TR / css3-background /#the-box-shadow

您可以在Chrome和Firefox中通过检查计算样式列表来验证。其他具有速记方法的属性(例如 border-

You can verify this in Chrome and Firefox by checking the list of computed styles. Other properties that have shorthand methods (like border-radius) have their variations defined in the spec.

与大多数缺少的长手CSS属性一样, CSS变量可以解决此问题:

As with most missing "long-hand" CSS properties, CSS variables can solve this problem:

#el {
    --box-shadow-color: palegoldenrod;
    box-shadow: 1px 2px 3px var(--box-shadow-color);
}

#el:hover {
    --box-shadow-color: goldenrod;
}

您可以在Firefox 31+中尝试。不幸的是,在撰写本文时,没有其他浏览器可以正常工作。

You can try this out in Firefox 31+. Unfortunately, at the time of writing, no other browsers have a working implementation.

这篇关于是否有一个“box-shadow-color”属性?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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