示例工程 24-fluid-typography

24-fluid-typography/demo-01-scale/index.html

html · 0.8 KB

运行:clamp 的三种配方

点击「运行示例」后,左侧显示源码、右侧显示运行结果;console 输出会实时回传。

<!doctype html>
<html lang="zh-CN">
  <head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <title>clamp 的三种配方</title>
    <link rel="stylesheet" href="style.css" />
  </head>
  <body>
    <h1>clamp 的三种配方</h1>
    <p>缩窄窗口:三条标题都会连续变小,并在上下限处停住。</p>

    <section class="row">
      <span class="tag">clamp(1.5rem, 5vw, 3rem)</span>
      <p class="a">视口驱动</p>
    </section>

    <section class="row">
      <span class="tag">clamp(1.25rem, 1rem + 2vw, 2rem)</span>
      <p class="b">rem + vw 混合</p>
    </section>

    <section class="row">
      <span class="tag">clamp(1rem, 4vw, 1.5rem)</span>
      <p class="c">小范围</p>
    </section>
  </body>
</html>