1
+ <!DOCTYPE html>
2
+ < html >
3
+ < head >
4
+ < meta charset ="utf-8 " />
5
+ < meta http-equiv ="X-UA-Compatible " content ="Edge,chrome=1 " />
6
+ < title > 用css border实现三角形</ title >
7
+ < style >
8
+ .triangle {
9
+ width : 0px ;
10
+ height : 0px ;
11
+ margin : 20px ;
12
+ }
13
+ .first {
14
+ border-top : 50px solid blue;
15
+ border-right : 50px solid yellow;
16
+ border-bottom : 50px solid green;
17
+ border-left : 50px solid red;
18
+ }
19
+ .second {
20
+ border-top : 50px solid blue;
21
+ border-right : 50px solid transparent;
22
+ border-bottom : 50px solid transparent;
23
+ border-left : 50px solid transparent;
24
+ }
25
+ .third {
26
+ border-top : 50px solid transparent;
27
+ border-right : 50px solid transparent;
28
+ border-bottom : 50px solid transparent;
29
+ border-left : 50px solid red;
30
+ }
31
+ .fourth {
32
+ border-top : 50px solid transparent;
33
+ border-right : 50px solid yellow;
34
+ border-bottom : 50px solid transparent;
35
+ border-left : 50px solid transparent;
36
+ }
37
+ .fifth {
38
+ border-top : 50px solid transparent;
39
+ border-right : 50px solid transparent;
40
+ border-bottom : 50px solid green;
41
+ border-left : 50px solid transparent;
42
+ }
43
+ .sixth {
44
+ border-right : 70px solid transparent;
45
+ border-bottom : 75px solid red;
46
+ }
47
+ .seventh {
48
+ border-left : 75px solid transparent;
49
+ border-bottom : 75px solid green;
50
+ }
51
+
52
+ </ style >
53
+ </ head >
54
+ < body >
55
+ < div class ="first triangle "> </ div >
56
+ < div class ="second triangle "> </ div >
57
+ < div class ="third triangle "> </ div >
58
+ < div class ="fourth triangle "> </ div >
59
+ < div class ="fifth triangle "> </ div >
60
+ < div class ="sixth triangle "> </ div >
61
+ < div class ="seventh triangle "> </ div >
62
+ </ body >
63
+ </ html >
0 commit comments