Is there a 'box-shadow-color' property?

后端 未结 7 1586
情深已故
情深已故 2020-12-04 10:31

I have the following CSS:

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

Now I am trying to extract that color to make the page colors \'skinnable\'.

7条回答
  •  独厮守ぢ
    2020-12-04 11:14

    No:

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

    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.

    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;
    }
    

提交回复
热议问题