/
利用阴影复制自身图形.html
55 lines (49 loc) · 1.22 KB
/
利用阴影复制自身图形.html
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
div {
margin-bottom: 400px;
width: 80px;
height: 80px;
border: 1px solid #333;
box-sizing: border-box;
box-shadow: 80px 80px 0 0 #000;
}
p {
margin: 0 auto;
position: relative;
width: 500px;
text-align: center;
}
p::before,
p::after {
content: "";
position: absolute;
width: 10px;
height: 10px;
border-radius: 50%;
background: #000;
left: -10px;
top: 50%;
transform: translate(0, -50%);
box-shadow: -20px 0 #000, -40px 0 #000;
}
p::after {
left: unset;
right: -30px;
box-shadow: 20px 0 #000, 40px 0, #000;
}
</style>
</head>
<body>
<!-- 当阴影的模糊半径和阴影的扩张半径都为 0 的时候,能得到一个和元素本身一样大小的阴影效果,
不过此时,我们是看不到阴影效果的,因为阴影被元素本身挡住了。
当然,我们可以轻松地通过 X 偏移值和 Y 偏移值将其移动出来 -->
<div></div>
<p>Title</p>
</body>
</html>