示例工程 11-positioning
11-positioning/demo-01-relative-absolute/style.css
点击「运行示例」后,左侧显示源码、右侧显示运行结果;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;
}
.card {
position: relative;
margin-top: 14px;
padding: 28px;
border: 2px solid #2563eb;
border-radius: 12px;
background: #eff6ff;
}
.card h2 {
margin: 0;
font-size: 18px;
}
.card p {
margin: 6px 0 0;
color: #334155;
font-size: 14px;
}
.corner {
position: absolute;
padding: 2px 6px;
border-radius: 4px;
background: #0f172a;
color: #ffffff;
font-size: 10px;
font-family: ui-monospace, monospace;
}
.tl { top: 6px; left: 6px; }
.tr { top: 6px; right: 6px; }
.bl { bottom: 6px; left: 6px; }
.br { bottom: 6px; right: 6px; }