示例工程 59-blog-cards
59-blog-cards/demo-01-cards/style.css
点击「运行示例」后,左侧显示源码、右侧显示运行结果;console 输出会实时回传。
:root {
--ink: #0f172a;
--muted: #64748b;
--border: #e2e8f0;
--brand: #4f46e5;
--brand-soft: #e0e7ff;
--surface: #ffffff;
}
body {
margin: 0;
padding: 32px;
background: #f8fafc;
color: var(--ink);
font-family: system-ui, sans-serif;
line-height: 1.7;
}
h1 { margin: 0 0 4px; font-size: 28px; }
p { margin: 0 0 20px; color: var(--muted); font-size: 14px; }
.featured {
display: grid;
grid-template-columns: 1.1fr 0.9fr;
max-width: 900px;
overflow: hidden;
border: 1px solid var(--border);
border-radius: 16px;
background: var(--surface);
}
.featured-media {
min-height: 260px;
background: linear-gradient(135deg, #4f46e5, #7c3aed);
}
.featured-body {
display: flex;
flex-direction: column;
justify-content: center;
gap: 8px;
padding: 28px;
}
.meta { margin: 0; color: var(--muted); font-size: 11px; font-family: ui-monospace, monospace; }
.featured-body h2 { margin: 0; font-size: 24px; line-height: 1.2; }
.featured-body p { margin: 0; color: var(--muted); font-size: 14px; }
.featured-body a { color: var(--brand); font-size: 13px; }
.grid {
display: grid;
grid-template-columns: repeat(3, minmax(0, 1fr));
gap: 16px;
max-width: 900px;
margin-top: 20px;
}
.post {
display: flex;
flex-direction: column;
overflow: hidden;
border: 1px solid var(--border);
border-radius: 12px;
background: var(--surface);
}
.media {
aspect-ratio: 16 / 9;
background: var(--brand-soft);
}
.blue { background: linear-gradient(135deg, #2563eb, #0ea5e9); }
.amber { background: linear-gradient(135deg, #f59e0b, #f97316); }
.green { background: linear-gradient(135deg, #15803d, #22c55e); }
.body {
display: flex;
flex: 1 1 auto;
flex-direction: column;
gap: 4px;
padding: 16px;
}
.body h2 { margin: 0; font-size: 17px; line-height: 1.3; }
.body p { margin: 0; font-size: 13px; }
.excerpt {
display: -webkit-box;
overflow: hidden;
-webkit-box-orient: vertical;
-webkit-line-clamp: 3;
line-clamp: 3;
}
.body a { margin-top: auto; padding-top: 8px; color: var(--brand); font-size: 13px; }
@media (max-width: 800px) {
.featured { grid-template-columns: minmax(0, 1fr); }
.featured-media { min-height: 200px; }
}
@media (max-width: 760px) {
.grid { grid-template-columns: minmax(0, 1fr); }
}