1个回答

test
2024-07-16
利用clip-path的polygon函数进行裁剪就很容易做到
HTML部分
<div class="container">
<div class="status">空闲</div>
<div class="number">3<span>台</span></div>
</div>
CSS部分
.container {
width: 600px;
height: 300px;
background-color: #FFD900;
border-radius: 20px;
position: relative;
}
.container .status {
text-align: right;
color: #fff;
margin: 50px 50px 0;
font-size: 40px;
font-weight: 700;
}
.container .number {
width: 580px;
height:280px;
position: absolute;
top: 10px;
left: 10px;
background-color: #fff;
z-index: 2;
display: flex;
align-items: flex-end;
font-weight: 700;
font-size: 40px;
padding-left: 50px;
padding-bottom: 50px;
box-sizing: border-box;
clip-path: polygon(0% 0%,30% 0px,70% 50%,100% 50%,100% 100%,0 100%);
}
.container .number span {
color: #ddd;
margin-left: 30px;
}
回复

适合作为回答的
- 经过验证的有效解决办法
- 自己的经验指引,对解决问题有帮助
- 遵循 Markdown 语法排版,代码语义正确
不该作为回答的
- 询问内容细节或回复楼层
- 与题目无关的内容
- “赞”“顶”“同问”“看手册”“解决了没”等毫无意义的内容