示例工程 07-backgrounds-borders-shadows
07-backgrounds-borders-shadows/demo-01-backgrounds/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 12px;
font-size: 28px;
}
.grid {
display: grid;
grid-template-columns: repeat(2, minmax(0, 1fr));
gap: 12px;
}
.tile {
display: grid;
place-items: end start;
min-height: 150px;
padding: 12px;
border-radius: 12px;
color: #ffffff;
font-size: 11px;
font-family: ui-monospace, monospace;
}
.linear {
background: linear-gradient(135deg, #2563eb, #7c3aed);
}
.radial {
background: radial-gradient(circle at 30% 30%, #f59e0b, #dc2626 70%);
}
.pattern {
background:
repeating-linear-gradient(45deg, #0f172a 0 8px, #1e293b 8px 16px);
}
.position {
background-color: #0f172a;
background-image: radial-gradient(circle, #60a5fa 0 3px, transparent 3.5px);
background-size: 20px 20px;
background-position: 10px 10px;
}
@media (max-width: 640px) {
.grid {
grid-template-columns: 1fr;
}
}