通过
border-radius
border
transform
伪元素配合
gradient 渐变
可以打出很多图形
比如
三角
.traingle {
width
:
0
;
height
:
0
;
border-left
:
50px
solid
transparent
;
border-right
:
50px
solid
transparent
;
border-bottom
:
100px
solid
yellowgreen;
}
切角
.notching {
width
:
40px
;
height
:
40px
;
padding
:
40px
;
background
: linear-gradient(
135
deg,
transparent
15px
, yellowgreen
0
)
top
left
,
linear-gradient(
-135
deg,
transparent
15px
, yellowgreen
0
)
top
right
,
linear-gradient(
-45
deg,
transparent
15px
, yellowgreen
0
)
bottom
right
,
linear-gradient(
45
deg,
transparent
15px
, yellowgreen
0
)
bottom
left
;
background-
size
:
50%
50%
;
background-repeat
:
no-repeat
;
}
梯形
.trapezoid{
position
:
relative
;
width
:
60px
;
padding
:
60px
;
}
.trapezoid::before{
content
:
""
;
position
:
absolute
;
top
:
0
;
right
:
0
;
bottom
:
0
;
left
:
0
;
transform: perspective(
20px
) scaleY(
1.3
) rotateX(
5
deg);
transform-origin:
bottom
;
background
: yellowgreen;
}
五边
.pentagon {
position
:
relative
;
width
:
60px
;
border-bottom
:
60px
solid
yellowgreen;
border-left
:
40px
solid
transparent
;
border-right
:
40px
solid
transparent
;
}
.pentagon::before {
content
:
""
;
position
:
absolute
;
top
:
60px
;
left
:
-40px
;
border-top
:
60px
solid
yellowgreen;
border-left
:
70px
solid
transparent
;
border-right
:
70px
solid
transparent
;
}
六边
.pentagon {
position
:
relative
;
width
:
60px
;
border-bottom
:
60px
solid
yellowgreen;
border-left
:
40px
solid
transparent
;
border-right
:
40px
solid
transparent
;
}
.pentagon::before {
content
:
""
;
position
:
absolute
;
width
:
60px
;
height
:
0px
;
top
:
60px
;
left
:
-40px
;
border-top
:
60px
solid
yellowgreen;
border-left
:
40px
solid
transparent
;
border-right
:
40px
solid
transparent
;
}
八边
.octagon {
position
:
relative
;
width
:
40px
;
height
:
100px
;
background
: yellowgreen;
}
.octagon::before {
content
:
""
;
height
:
60px
;
position
:
absolute
;
top
:
0
;
left
:
40px
;
border-left
:
30px
solid
yellowgreen;
border-top
:
20px
solid
transparent
;
border-bottom
:
20px
solid
transparent
;
}
.octagon::after {
content
:
""
;
height
:
60px
;
position
:
absolute
;
top
:
0
;
left
:
-30px
;
border-right
:
30px
solid
yellowgreen;
border-top
:
20px
solid
transparent
;
border-bottom
:
20px
solid
transparent
;
}
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 分享一个免费、快速、无限量使用的满血 DeepSeek R1 模型,支持深度思考和联网搜索!
· 基于 Docker 搭建 FRP 内网穿透开源项目(很简单哒)
· ollama系列01:轻松3步本地部署deepseek,普通电脑可用
· 25岁的心里话
· 按钮权限的设计及实现