示例工程 23-container-queries

23-container-queries/demo-02-units/index.html

html · 0.8 KB

运行:容器单位 cqw

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

<!doctype html>
<html lang="zh-CN">
  <head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <title>容器单位 cqw</title>
    <link rel="stylesheet" href="style.css" />
  </head>
  <body>
    <h1>容器单位 cqw</h1>
    <p>1cqw = 容器宽度的 1%;同一套 CSS,容器越大,内边距与字号越大。</p>

    <div class="row">
      <div class="host w-240">
        <div class="box">
          <strong>240px</strong>
          <p>padding 4cqw;字号 8cqw。</p>
        </div>
      </div>
      <div class="host w-480">
        <div class="box">
          <strong>480px</strong>
          <p>同样的 cqw,得到更大的值。</p>
        </div>
      </div>
    </div>
  </body>
</html>