示例工程 24-fluid-typography

24-fluid-typography/demo-01-scale/style.css

css · 0.6 KB

运行:clamp 的三种配方

点击「运行示例」后,左侧显示源码、右侧显示运行结果;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;
}

.row {
  max-width: 720px;
  margin-top: 20px;
  padding: 14px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #ffffff;
}

.tag {
  color: #2563eb;
  font-size: 11px;
  font-family: ui-monospace, monospace;
}

.row p {
  margin: 4px 0 0;
  font-weight: 700;
  line-height: 1.15;
}

.a { font-size: clamp(1.5rem, 5vw, 3rem); }
.b { font-size: clamp(1.25rem, 1rem + 2vw, 2rem); }
.c { font-size: clamp(1rem, 4vw, 1.5rem); }