使用CSS的阴影效果

时间:2015-05-05 06:07:42

标签: css css3

我需要实现阴影效果,如下面附加的模型。我已经强调了我需要实现为红色框的阴影效果。我被告知使用精灵图像来实现我不喜欢的阴影效果。我可以使用CSS3阴影效果来实现吗?

enter image description here

请咨询

1 个答案:

答案 0 :(得分:7)

试试这个:

hr {
height: 1px;
margin: 50px 0;
background: -webkit-gradient(linear, 0 0, 100% 0, from(rgba(0,0,0,0)), color-stop(0.5, #333333), to(rgba(0,0,0,0)));
background: -webkit-linear-gradient(left, rgba(0,0,0,0), #333333, rgba(0,0,0,0));
background: -moz-linear-gradient(left, rgba(0,0,0,0), #333333, rgba(0,0,0,0));
background: -o-linear-gradient(left, rgba(0,0,0,0), #333333, rgba(0,0,0,0));
background: linear-gradient(left, rgba(0,0,0,0), #333333, rgba(0,0,0,0));
border: 0;
}

hr:after { 
display: block; 
content:'';
height: 30px;
background: -webkit-gradient(radial, 50% 0%, 0, 50% 0%, 116, color-stop(0%, #cccccc), color-stop(100%, rgba(255, 255, 255, 0)));
background: -webkit-radial-gradient(center top, farthest-side, #cccccc 0%, rgba(255, 255, 255, 0) 100%);
background: -moz-radial-gradient(center top, farthest-side, #cccccc 0%, rgba(255, 255, 255, 0) 100%);
background: -o-radial-gradient(center top, farthest-side, #cccccc 0%, rgba(255, 255, 255, 0) 100%);
background: radial-gradient(farthest-side at center top, #cccccc 0%, rgba(255, 255, 255, 0) 100%);
}
<hr>