示例工程 47-naming-conventions
47-naming-conventions/demo-02-scope/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 4px; font-size: 26px; }
p { margin: 0 0 20px; color: #64748b; font-size: 14px; }
.panel {
max-width: 420px;
margin-bottom: 12px;
padding: 14px;
border: 1px solid #e2e8f0;
border-radius: 10px;
}
.panel.blue { background: #eff6ff; }
.panel.green { background: #f0fdf4; }
.panel p { margin: 4px 0 0; font-size: 13px; }
@scope (.blue) {
.title { color: #2563eb; }
}
@scope (.green) {
.title { color: #16a34a; }
}
.title.outside {
margin-top: 20px;
padding-top: 12px;
border-top: 1px dashed #e2e8f0;
color: #0f172a;
font-size: 16px;
}