记录一下box-shadow的扩展使用。利用多投影(倾斜投影与主体投影)重叠的原理,实现曲线阴影与翘边阴影的效果:
慕课网视频地址
  效果图:img

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>img wall</title>

<link rel="stylesheet" href="img.css">

</head>
<body>

<div class="wrap effect">
<h1>shadow effect</h1>
</div>
<ul class="box">
<li><img src="./img/photo1.jpg" alt=""></li>
<li><img src="./img/photo2.jpg" alt=""></li>
<li><img src="./img/photo3.jpg" alt=""></li>
</ul>
</body>
</html>

img.css

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
body{
font-family: Arial;
font-size: 23px;
}
.wrap h1{
text-align: center;
position: relative;
top: 50px;
}
.wrap{
width: 70%;
height: 200px;
background: #fff;
margin: 40px auto;

}
.effect{
position: relative;
box-shadow: 0 1px 4px rgba(0,0,0,0.3),0 0 40px rgba(0,0,0,0.1) inset;
}
.effect:before,.effect:after{
content: '';
z-index: -1;
position: absolute;
box-shadow: 0 0 20px rgba(0,0,0,0.8) ;
top:50%;
bottom: 0;
left: 10px;
right: 10px;
border-radius: 100px/10px;
}

.box{
width: 980px;
height: auto;
margin: 20px auto;
padding:0;
clear: both;
overflow: hidden;
}
.box li{
list-style-type: none;
margin: 20px 10px;
padding: 0;
width: 300px;
height: 220px;
border: 2px solid #efefef;
position: relative;
float: left;
background: #ffffff;
line-height: 220px;
-webkit-box-shadow: 0 1px 4px rgba(0, 0, 0, 0.27),0 0 60px rgba(0,0,0,0.1) inset;
-moz-box-shadow:0 1px 4px rgba(0, 0, 0, 0.27),0 0 60px rgba(0,0,0,0.1) inset;
box-shadow: 0 1px 4px rgba(0, 0, 0, 0.27),0 0 60px rgba(0,0,0,0.1) inset;
}

.box li img{
width: 290px;
height: 210px;
padding: 5px;;
}

.box li:before{
position: absolute;
background: transparent;
z-index: -1;
width: 90%;
height: 80%;
content: '';
left: 20px;
bottom: 8px;
transform: skew(-12deg) rotate(-4deg);
-webkit-box-shadow: 0 8px 20px rgba(0,0,0,0.6);
-moz-box-shadow: 0 8px 20px rgba(0,0,0,0.6);
box-shadow: 0 8px 20px rgba(0,0,0,0.6);
}

.box li:after{
position: absolute;
background: transparent;
z-index: -1;
width: 90%;
height: 80%;
content: '';
left: 20px;
bottom: 8px;
transform: skew(12deg) rotate(4deg);
-webkit-box-shadow: 0 8px 20px rgba(0,0,0,0.6);
-moz-box-shadow: 0 8px 20px rgba(0,0,0,0.6);
box-shadow: 0 8px 20px rgba(0,0,0,0.6);
}