规规矩矩的图形(长方形或者正方形)加阴影,可以用box-shadow,但是不规则的,比如说三角形,加阴影的时候用box-shadow就不合适了,这时候可以用filter:drop-shadow()
<div class="box"></div>
<style>
.box{
width: 250px;
height: 100px;
position: relative;
background: radial-gradient(circle at right top, transparent 10px, #28A4F2 0) top left / 60px 51% no-repeat,
radial-gradient(circle at right bottom, transparent 10px, #28A4F2 0) bottom left /60px 51% no-repeat,
radial-gradient(circle at left top, transparent 10px, #eeeeee 0) top right /190px 51% no-repeat,
radial-gradient(circle at left bottom, transparent 10px, #eeeeee 0) bottom right /190px 51% no-repeat;
filter: drop-shadow(3px 3px 3px rgba(0,0,0,.3));
}
</style>
效果图如图:
文字使用该属性同样可以,
<div class="text"></div>
<style>
.text{
filter: drop-shadow(4px 4px 1px #8dbaff);
color: #f40;
}
</style>
效果图如下: