Add additional box-shadow to an element where existing shadow is unknown

后端 未结 4 1408
庸人自扰
庸人自扰 2021-02-14 05:17

I\'m assuming the answer to this question is that it\'s impossible, but I\'m asking anyway in the hopes that someone knows of a clever workaround.

Let\'s say I have the

4条回答
  •  天命终不由人
    2021-02-14 05:57

    An absolutely positioned pseudo-element (with the original container having position set) seems like the only solution:

    See the fiddle. (I did different size/color for visual).

    .test:before {
        content: '';
        position: absolute;
        top: 0;
        right: 0;
        bottom: 0;
        left: 0;
        box-shadow:3px 3px rgba(275,0,0,.25);
    }
    

提交回复
热议问题