混合模式:photoshop提供了各式各样的混合模式,但是css3阴影只支持正常模式(normal)。
颜色(color):阴影颜色。对应于css3阴影中的 color 值。
不透明度(opacity):阴影的不透明度。对应于css3阴影的颜色 rgba() 中的 a 值。
角度(angle):投影的角度。
距离(distance):阴影的距离。根据角度和距离可以换算出css3阴影中的x-offset和y-offet。 x-offset = distance * cos(180 -angle) , y-offset = distance * sin(180 - angle)
扩展(spread):阴影的扩展大小。控制阴影实体颜色和虚化颜色的多少。 spread * size = 阴影中实体颜色的大小 。剩下的就是虚化的颜色。css3阴影 spread-radius = spread * size
大小(size):阴影的大小。在css3中 blur-radius + spread-radius = size 即 blur-radius = size - spread-radius 。
以上图中的数值为例。
color: rgba(118,113,113,.75)x-offset: 5 * cos(180°- 145°) = 4.09pxy-offset: 5 * sin(180°- 145°) = 2.87pxspread-radius: 10 * 6% = 0.6pxblur-radius: 10 - 0.6 = 9.4px;
box-shadow: 4.09px 2.87px 9.4px 0.6px rgba(118,113,113,.75);text-shadow: 4.09px 2.87px 9.4px rgba(118,113,113,.75);
text-shadow 没有 spread-radius 所以不能完全实现ps中的效果。