示例工程 11-positioning
11-positioning/demo-01-relative-absolute/index.html
点击「运行示例」后,左侧显示源码、右侧显示运行结果;console 输出会实时回传。
<!doctype html>
<html lang="zh-CN">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>relative 与 absolute</title>
<link rel="stylesheet" href="style.css" />
</head>
<body>
<h1>relative 与 absolute</h1>
<p>卡片是 relative,四个角标是 absolute。</p>
<article class="card">
<span class="corner tl">TL</span>
<span class="corner tr">TR</span>
<span class="corner bl">BL</span>
<span class="corner br">BR</span>
<h2>定位祖先</h2>
<p>角标以卡片的 padding box 为参照,不占文档流。</p>
</article>
</body>
</html>