-
Notifications
You must be signed in to change notification settings - Fork 0
/
CSS三角形.html
88 lines (85 loc) · 3.08 KB
/
CSS三角形.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
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>CSS三角形</title>
<style>
div {
/*背景色方便对比显示*/
background: #999999;
/*必要条件*/
box-sizing: border-box;
/*宽高根据实际需要设置*/
width: 100px;
height: 100px;
/*方便布局*/
margin-bottom: 32px;
}
.border {
border-top: 50px solid red;
border-bottom: 50px solid green;
border-left: 50px solid blue;
border-right: 50px solid yellow;
}
.border-top {
border-top: 50px solid red;
border-bottom: 50px solid transparent;
border-left: 50px solid transparent;
border-right: 50px solid transparent;
}
.border-bottom {
border-top: 50px solid transparent;
border-bottom: 50px solid green;
border-left: 50px solid transparent;
border-right: 50px solid transparent;
}
.border-left {
border-top: 50px solid transparent;
border-bottom: 50px solid transparent;
border-left: 50px solid blue;
border-right: 50px solid transparent;
}
.border-right {
border-top: 50px solid transparent;
border-bottom: 50px solid transparent;
border-left: 50px solid transparent;
border-right: 50px solid yellow;
}
.border-left-top {
border-top: 50px solid red;
border-bottom: 50px solid transparent;
border-left: 50px solid blue;
border-right: 50px solid transparent;
}
.border-left-bottom {
border-top: 50px solid transparent;
border-bottom: 50px solid green;
border-left: 50px solid blue;
border-right: 50px solid transparent;
}
.border-right-top {
border-top: 50px solid red;
border-bottom: 50px solid transparent;
border-left: 50px solid transparent;
border-right: 50px solid yellow;
}
.border-right-bottom {
border-top: 50px solid transparent;
border-bottom: 50px solid green;
border-left: 50px solid transparent;
border-right: 50px solid yellow;
}
</style>
</head>
<body>
<div class="border"></div>
<div class="border-top"></div>
<div class="border-bottom"></div>
<div class="border-left"></div>
<div class="border-right"></div>
<div class="border-left-top"></div>
<div class="border-left-bottom"></div>
<div class="border-right-top"></div>
<div class="border-right-bottom"></div>
</body>
</html>