How can I add a box-shadow on one side of an element?

后端 未结 13 1117
萌比男神i
萌比男神i 2020-11-28 17:34

I need to create a box-shadow on some block element, but only (for example) on its right side. The way I do it is to wrap the inner element with box-shado

13条回答
  •  情歌与酒
    2020-11-28 18:07

    Here's a little hack that I did.

    1. Create a

    right below the element that I want to create the one-side box shadow (in this case I want a one-sided inset shadow for id="element" coming from the bottom)

    2. Then I created a regular box-shadow using a negative vertical offset to push the shadow upwards to one-side.

    `box-shadow: 0 -8px 20px 2px #DEDEE3;`
    

提交回复
热议问题