# CSS3 图形绘制
# 三角形
<div class="triangle"></div>
<style>
.triangle{
width: 0;
height: 0;
border-top: 0px;
border-bottom: 30px solid red;
border-left: 15px solid transparent;
border-right: 15px solid transparent;
}
</style>
1
2
3
4
5
6
7
8
9
10
11
12
2
3
4
5
6
7
8
9
10
11
12
# 直角三角形
<div class="right-triangle"></div>
<style>
.right-triangle{
width: 0;
height: 0;
border-left: 30px solid transparent;
border-bottom: 30px solid red;
}
</style>
1
2
3
4
5
6
7
8
9
10
2
3
4
5
6
7
8
9
10
# 半圆
<div class="harf-circle"></div>
<style>
.harf-circle{
width: 30px;
height: 15px;
background: red;
border-radius: 15px 15px 0 0;
}
</style>
1
2
3
4
5
6
7
8
9
2
3
4
5
6
7
8
9
# 平行四边形
<div class="paralle"></div>
<style>
.paralle{
width: 300px;
height: 150px;
transform: skewX(-48deg);
background: linear-gradient(0deg, #0840C8, #06297D);
}
</style>
1
2
3
4
5
6
7
8
9
2
3
4
5
6
7
8
9
# 梯形
<div class="ladder">
</div>
<style>
.ladder{
margin-left: 300px;
height: 100px;
width:100px;
background-color: blue;
position: relative;
}
.ladder:before{
content: "";
border-bottom: 100px solid red;
border-left: 100px solid transparent;
position: absolute;
left: -100px;
}
.ladder:after{
content: "";
border-bottom: 100px solid red;
border-right: 100px solid transparent;
position: absolute;
right: -100px;
}
</style>
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
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25