示例工程 06-text-typography
06-text-typography/app/style.css
点击「运行示例」后,左侧显示源码、右侧显示运行结果;console 输出会实时回传。
*,
*::before,
*::after {
box-sizing: border-box;
}
body,
h1,
h2,
p,
blockquote {
margin: 0;
}
body {
min-height: 100vh;
background: #f8fafc;
color: #0f172a;
font-family: system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
font-size: 16px;
line-height: 1.75;
text-rendering: optimizeLegibility;
}
.site-header {
display: flex;
align-items: center;
justify-content: space-between;
gap: 16px;
padding: 16px 24px;
border-bottom: 1px solid #e2e8f0;
background: #ffffff;
}
.brand {
font-size: 13px;
font-weight: 700;
letter-spacing: 0.16em;
}
.site-header nav {
display: flex;
gap: 16px;
}
.site-header nav a {
color: #64748b;
font-size: 13px;
text-decoration: none;
}
.site-header nav a:hover,
.site-header nav a:focus-visible {
color: #2563eb;
}
.page {
width: min(100% - 40px, 900px);
margin: 0 auto;
padding: 48px 0 72px;
}
.essay {
max-width: 68ch;
margin: 0 auto;
}
.eyebrow {
color: #64748b;
font-size: 11px;
letter-spacing: 0.18em;
}
h1 {
margin: 8px 0 6px;
font-size: clamp(32px, 5vw, 46px);
line-height: 1.15;
letter-spacing: -0.02em;
text-wrap: balance;
}
.meta {
color: #64748b;
font-size: 13px;
}
.lead {
margin-top: 20px;
padding-left: 14px;
border-left: 3px solid #2563eb;
color: #334155;
font-size: 18px;
line-height: 1.65;
}
h2 {
margin-top: 36px;
font-size: 22px;
line-height: 1.3;
letter-spacing: -0.01em;
}
section p {
margin-top: 12px;
color: #334155;
}
.sample-serif {
font-family: Georgia, "Times New Roman", "Songti SC", serif;
font-size: 17px;
}
.sample-mono {
padding: 8px 10px;
border-radius: 8px;
background: #0f172a;
color: #e2e8f0;
font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
font-size: 13px;
}
.narrow {
max-width: 30ch;
padding: 10px 12px;
border-radius: 8px;
background: #f1f5f9;
}
.indent {
text-indent: 2em;
}
.balance {
max-width: 34ch;
text-wrap: balance;
}
blockquote {
margin-top: 36px;
padding: 18px 20px;
border-left: 4px solid #2563eb;
border-radius: 0 10px 10px 0;
background: #eff6ff;
}
blockquote p {
color: #1e3a8a;
font-size: 17px;
}
blockquote cite {
display: block;
margin-top: 8px;
color: #64748b;
font-size: 12px;
font-style: normal;
}
code {
padding: 1px 5px;
border-radius: 4px;
background: #f1f5f9;
font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
font-size: 0.9em;
}
.site-footer {
padding: 20px 24px 36px;
color: #64748b;
font-size: 12px;
text-align: center;
}
@media (max-width: 640px) {
.site-header {
align-items: flex-start;
flex-direction: column;
padding: 14px 18px;
}
.page {
width: min(100% - 28px, 900px);
padding: 28px 0 48px;
}
.essay {
max-width: none;
}
h1 {
font-size: clamp(28px, 9vw, 40px);
}
.lead {
font-size: 16px;
}
.narrow,
.balance {
max-width: none;
}
}