*, *::before, *::after { box-sizing: border-box; } body, h1, h2, h3, p { margin: 0; } body { background: #f8fafc; color: #0f172a; font-family: system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif; line-height: 1.7; } .site-header { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; padding: 16px 24px; border-bottom: 1px solid #e2e8f0; background: #ffffff; } .brand { font-size: 0.75rem; font-weight: 700; letter-spacing: 0.14em; } .site-header nav { display: flex; flex-wrap: wrap; gap: 14px; } .site-header nav a { color: #64748b; font-size: 0.8125rem; text-decoration: none; } .site-header nav a:hover, .site-header nav a:focus-visible { color: #2563eb; } .page { width: min(100% - 40px, 880px); margin: 0 auto; padding-bottom: 4rem; } /* 首屏:dvh + clamp + ch */ .hero { display: flex; flex-direction: column; justify-content: center; gap: 0.75rem; min-height: 60vh; min-height: 60dvh; padding: 2rem 0; border-bottom: 1px solid #e2e8f0; } .eyebrow { color: #64748b; font-size: 0.6875rem; letter-spacing: 0.18em; } h1 { font-size: clamp(2rem, 6vw, 3.5rem); line-height: 1.12; letter-spacing: -0.02em; } .lead { max-width: 46ch; color: #334155; font-size: 1.0625rem; } .hero-note { color: #64748b; font-size: 0.8125rem; } .panel { margin-top: 1.5rem; padding: 1.5rem; border: 1px solid #e2e8f0; border-radius: 1rem; background: #ffffff; } h2 { font-size: 1.125rem; } .panel > p { margin-top: 0.5rem; color: #334155; font-size: 0.875rem; } .hint { color: #64748b !important; font-size: 0.75rem !important; } /* 1. px / rem / em */ .unit-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.75rem; margin-top: 1rem; } .unit-box { padding: 1rem; border: 1px solid #e2e8f0; border-radius: 0.75rem; background: #f8fafc; } .unit-tag { color: #2563eb; font-size: 0.6875rem; font-family: ui-monospace, Menlo, monospace; } .unit-box p { margin-top: 0.375rem; color: #0f172a; } .u-px { font-size: 16px; } .u-rem { font-size: 1rem; } .em-parent { font-size: 20px; } .u-em { font-size: 1em; } /* 2. % 与 vw */ .percent-demo { width: 320px; max-width: 100%; margin-top: 1rem; padding: 0.5rem; overflow: hidden; border: 1px dashed #cbd5e1; border-radius: 0.5rem; background: #f8fafc; } .bar { display: flex; align-items: center; height: 1.75rem; padding-left: 0.5rem; color: #ffffff; font-size: 0.6875rem; font-family: ui-monospace, Menlo, monospace; } .bar + .bar { margin-top: 0.5rem; } .percent { width: 50%; background: #2563eb; } .vw { width: 50vw; background: #7c3aed; } /* 3. ch 行宽 */ .measure { max-width: 65ch; margin-top: 1rem; padding: 1rem; border-left: 3px solid #2563eb; background: #f8fafc; } .measure h3 { font-size: 1rem; } .measure p { margin-top: 0.5rem; color: #334155; font-size: 0.9375rem; } /* 4. dvh */ .height-demo { display: grid; place-items: center; height: 40vh; height: 40dvh; margin-top: 1rem; border-radius: 0.75rem; background: linear-gradient(135deg, #2563eb, #7c3aed); color: #ffffff; font-size: 0.75rem; font-family: ui-monospace, Menlo, monospace; } /* 5. 表格 */ .table-wrap { margin-top: 1rem; overflow-x: auto; } table { width: 100%; border-collapse: collapse; font-size: 0.8125rem; } th, td { padding: 0.5rem 0.625rem; border-bottom: 1px solid #e2e8f0; text-align: left; white-space: nowrap; } th { color: #64748b; font-weight: 600; } code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.875em; } .site-footer { padding: 1.25rem 1.5rem 2.25rem; color: #64748b; font-size: 0.75rem; text-align: center; } @media (max-width: 720px) { .site-header { padding: 0.75rem 1.125rem; } .page { width: min(100% - 1.75rem, 880px); } .panel { padding: 1.125rem; } .unit-row { grid-template-columns: minmax(0, 1fr); } }