一、
.tri1 {
width: 0; height: 0;
border-color: red blue red blue;
border-width: 50px 50px 50px 50px;
border-style: solid;
}
二、
.tri2 {
width: 0; height: 0;
border-color: red blue blue red;
border-width: 50px 50px 50px 50px;
border-style: solid;
}
三、
.tri3 {
width: 0; height: 0;
border-color: transparent red; /*上下颜色 左右颜色*/
border-width: 0 0 50px 50px;
border-style: solid;
}
四、
.tri4 {
width: 0; height: 0;
border-color: red transparent; /*上下颜色 左右颜色*/
border-width: 0 0 50px 50px;
border-style: solid;
}
五、
.tri5 {
width: 0; height: 0;
border-color: red transparent; /*上下颜色 左右颜色*/
border-width: 0 50px 50px 0;
border-style: solid;
}
六、
.tri6 {
width: 0; height: 0;
border-color: transparent red; /*上下颜色 左右颜色*/
border-width: 0 50px 50px 0;
border-style: solid;
}
七、绘制五角星
/*五角星 由三个等边三角形拼接而成*/
#star-five {
position: relative;
width: 0; height: 0;
border-left: 100px solid transparent;
border-right: 100px solid transparent;
border-bottom: 70px solid #039ae9;
transform: rotate(35deg);
margin: 50px;
}
#star-five::before {
content: "";
position: absolute; top: 3px; right: -95px;
width: 0; height: 0;
border-left: 100px solid transparent;
border-right: 100px solid transparent;
border-bottom: 70px solid #039ae9;
transform: rotate(-70deg);
}
#star-five::after {
content: "";
position: absolute; top: 6px; right: -96px;
border-left: 100px solid transparent;
border-right: 100px solid transparent;
border-bottom: 70px solid #039ae9;
transform: rotate(-145deg);
}
八、Triangle Up
#triangle-up {
width: 0;
height: 0;
border-left: 50px solid transparent;
border-right: 50px solid transparent;
border-bottom: 100px solid red;
}
九、Triangle Down
#triangle-down {
width: 0;
height: 0;
border-left: 50px solid transparent;
border-right: 50px solid transparent;
border-top: 100px solid red;
}
十、Triangle Left
#triangle-left {
width: 0;
height: 0;
border-top: 50px solid transparent;
border-right: 100px solid red;
border-bottom: 50px solid transparent;
}
A、Triangle Right
#triangle-right {
width: 0;
height: 0;
border-top: 50px solid transparent;
border-left: 100px solid red;
border-bottom: 50px solid transparent;
}
B、Curved Tail Arrow
#curvedarrow {
position: relative;
width: 0;
height: 0;
border-top: 9px solid transparent;
border-right: 9px solid red;
transform: rotate(10deg);
}
#curvedarrow:after {
content: "";
position: absolute;
border: 0 solid transparent;
border-top: 3px solid red;
border-radius: 20px 0 0 0;
top: -12px;
left: -9px;
width: 12px;
height: 12px;
transform: rotate(45deg);
}
C、Pentagon
#pentagon {
position: relative;
width: 54px;
box-sizing: content-box;
border-width: 50px 18px 0;
border-style: solid;
border-color: red transparent;
}
#pentagon:before {
content: "";
position: absolute;
height: 0;
width: 0;
top: -85px;
left: -18px;
border-width: 0 45px 35px;
border-style: solid;
border-color: transparent transparent red;
}
D、Heart (via Nicolas Gallagher)
#heart {
position: relative;
width: 100px;
height: 90px;
}
#heart:before,
#heart:after {
position: absolute;
content: "";
left: 50px;
top: 0;
width: 50px;
height: 80px;
background: red;
border-radius: 50px 50px 0 0;
transform: rotate(-45deg);
transform-origin: 0 100%;
}
#heart:after {
left: 0;
transform: rotate(45deg);
transform-origin: 100% 100%;
}
E、Infinity
#infinity {
position: relative;
width: 212px;
height: 100px;
box-sizing: content-box;
}
#infinity:before,
#infinity:after {
content: "";
box-sizing: content-box;
position: absolute;
top: 0;
left: 0;
width: 60px;
height: 60px;
border: 20px solid red;
border-radius: 50px 50px 0 50px;
transform: rotate(-45deg);
}
#infinity:after {
left: auto;
right: 0;
border-radius: 50px 50px 50px 0;
transform: rotate(45deg);
}
F、Yin Yang
#yin-yang {
width: 96px;
box-sizing: content-box;
height: 48px;
background: #eee;
border-color: red;
border-style: solid;
border-width: 2px 2px 50px 2px;
border-radius: 100%;
position: relative;
}
#yin-yang:before {
content: "";
position: absolute;
top: 50%;
left: 0;
background: #eee;
border: 18px solid red;
border-radius: 100%;
width: 12px;
height: 12px;
box-sizing: content-box;
}
#yin-yang:after {
content: "";
position: absolute;
top: 50%;
left: 50%;
background: red;
border: 18px solid #eee;
border-radius: 100%;
width: 12px;
height: 12px;
box-sizing: content-box;
}
G、Pointer
#pointer {
width: 200px;
height: 40px;
position: relative;
background: red;
}
#pointer:after {
content: "";
position: absolute;
left: 0;
bottom: 0;
width: 0;
height: 0;
border-left: 20px solid white;
border-top: 20px solid transparent;
border-bottom: 20px solid transparent;
}
#pointer:before {
content: "";
position: absolute;
right: -20px;
bottom: 0;
width: 0;
height: 0;
border-left: 20px solid red;
border-top: 20px solid transparent;
border-bottom: 20px solid transparent;
}
————————————————
更多css绘制的图形请参考:
https://css-tricks.com/the-shapes-of-css/
方法参考:https://blog.csdn.net/w214019153/article/details/52469866