示例工程 12-stacking-context

12-stacking-context/demo-01-z-index/index.html

html · 0.5 KB

运行:z-index 排序

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

<!doctype html>
<html lang="zh-CN">
  <head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <title>z-index 排序</title>
    <link rel="stylesheet" href="style.css" />
  </head>
  <body>
    <h1>z-index 排序</h1>
    <p>三个绝对定位盒子重叠;z-index 大的在上面。</p>
    <div class="stage">
      <div class="box a">A / 1</div>
      <div class="box b">B / 3</div>
      <div class="box c">C / 2</div>
    </div>
  </body>
</html>