仅在左和右的箱子阴影

仅在左和右的箱子阴影

本文介绍了仅在左和右的箱子阴影的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在一个只有左右影子的元素上创建一个插入盒阴影。我不能让它工作。

I am attempting to create an inset box-shadow on an element that only has the shadow on the left and right. I cannot get it to work.

这是我试过的盒子阴影:

Here is the box-shadow I tried:

 box-shadow: inset 10px 0px 25px 0px rgba(0,0,0,0.45);

我将为右侧添加另一个。问题是这个设置也显示阴影在顶部和底部,我不能得到它不显示,仍然显示在左侧的阴影。这是否可能?

I will add another one for the right side. The problem is this setting also shows the shadow slightly on the top and bottom and I cannot get it to not show and still show a shadow on the left side. Is this possible?


jsFiddle

推荐答案

在来缩小阴影。这可以隐藏不需要的顶部和底部阴影。

Use a negative value on spread-radius (4th value) to shrink the shadow. This can hide the unwanted top and bottom shadow.

box-shadow: inset 25px 0px 25px -25px rgba(0,0,0,0.45), inset -25px 0px 25px -25px rgba(0,0,0,0.45);

请参阅。

这篇关于仅在左和右的箱子阴影的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-24 16:52