示例工程 38-gradients-patterns
38-gradients-patterns/demo-01-gradients/style.css
点击「运行示例」后,左侧显示源码、右侧显示运行结果;console 输出会实时回传。
body {
margin: 0;
padding: 32px;
background: #f8fafc;
color: #0f172a;
font-family: system-ui, sans-serif;
line-height: 1.7;
}
h1 { margin: 0 0 8px; font-size: 26px; }
h2 {
margin: 18px 0 6px;
font-size: 12px;
color: #64748b;
font-family: ui-monospace, monospace;
}
.row {
display: flex;
flex-wrap: wrap;
gap: 12px;
}
.box {
width: 180px;
height: 110px;
border-radius: 10px;
}
.l1 { background: linear-gradient(90deg, #2563eb, #db2777); }
.l2 { background: linear-gradient(180deg, #2563eb, #db2777); }
.l3 { background: linear-gradient(to top right, #2563eb, #7c3aed, #db2777); }
.r1 { background: radial-gradient(circle at center, #fbbf24, #db2777 70%); }
.r2 { background: radial-gradient(circle at 20% 20%, #fbbf24, #312e81 70%); }
.r3 { background: radial-gradient(ellipse 80% 40% at 50% 50%, #22d3ee, #1e3a8a 80%); }
.c1 { background: conic-gradient(#2563eb 0 25%, #7c3aed 0 50%, #db2777 0 75%, #f59e0b 0 100%); }
.c2 { background: conic-gradient(from 45deg, #2563eb, #db2777, #f59e0b, #2563eb); }
.c3 { background: conic-gradient(from 90deg at 30% 30%, #22d3ee, #312e81, #22d3ee); }