
<!doctype html>
<html lang="zh-CN">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>渐变边框卡片 - 带底部三角</title>
<style>
:root{
--width: 220px;
--height: 160px;
--radius: 12px;
--border-thickness: 3px;
--triangle-size: 14px;
--grad-top: #8b5cf6;
--grad-bottom: #06b6d4;
--bg: #ffffff;
--content-padding: 18px;
--triangle-offset: 0px;
}
body{
display: grid;
place-items: center;
min-height: 100vh;
background: #f3f6fb;
margin: 0;
font-family: "PingFang SC","Helvetica Neue",Arial, sans-serif;
}
.grad-card {
position: relative;
width: var(--width);
height: var(--height);
padding: var(--border-thickness);
border-radius: calc(var(--radius) + var(--border-thickness));
background: linear-gradient(180deg, var(--grad-top), var(--grad-bottom));
box-sizing: border-box;
}
.grad-card .inner {
width: 100%;
height: 100%;
border-radius: var(--radius);
background: var(--bg);
box-sizing: border-box;
padding: var(--content-padding);
display: flex;
flex-direction: column;
justify-content: center;
box-shadow: 0 6px 18px rgba(12,20,40,0.08);
position: relative;
overflow: visible;
}
.grad-card::before {
content: "";
position: absolute;
left: 50%;
transform: translateX(-50%);
bottom: calc(-1 * (var(--triangle-size) - 2px));
width: calc(var(--triangle-size) * 2);
height: var(--triangle-size);
background: linear-gradient(180deg,var(--grad-bottom));
clip-path: polygon(0% 0%, 50% 100%, 100% 0%);
z-index: 1;
}
.grad-card::after {
content: "";
position: absolute;
left: 50%;
transform: translateX(-50%);
bottom: calc(-1 * (var(--triangle-size) - var(--border-thickness)) - 4);
width: calc((var(--triangle-size) - var(--border-thickness)) * 2);
height: calc(var(--triangle-size) - var(--border-thickness));
background: var(--bg);
clip-path: polygon(0% 0%, 50% 100%, 100% 0%);
z-index: 2;
}
.title {
font-size: 14px;
color: #667085;
margin: 0 0 6px 0;
font-weight: 600;
}
.value {
font-size: 40px;
font-weight: 800;
color: #0f172a;
margin: 0;
line-height: 1;
}
.muted-row {
margin-top: 8px;
display: flex;
align-items: center;
gap: 8px;
color: #94a3b8;
font-size: 14px;
}
.muted-row .up {
color: #10b981;
font-weight: 700;
}
</style>
</head>
<body>
<div class="grad-card" aria-hidden="false">
<div class="inner" role="group" aria-label="指标卡片">
<div class="title">新增评价数</div>
<div class="value">208</div>
<div class="muted-row">
<div>较上期</div>
<div class="up">↓ 20</div>
</div>
</div>
</div>
</body>
</html>