示例工程 41-has-is-where
41-has-is-where/demo-02-is-where/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 16px; font-size: 26px; }
h2 { margin: 24px 0 8px; font-size: 15px; color: #64748b; }
:is(h3, h4) {
margin: 0 0 8px;
padding-left: 8px;
border-left: 3px solid #2563eb;
}
.demo-subtitle { font-size: 16px; font-weight: 500; }
.btn {
display: inline-flex;
align-items: center;
min-height: 44px;
margin-right: 8px;
padding: 0 16px;
border: 1px solid #cbd5e1;
border-radius: 8px;
background: #ffffff;
color: #0f172a;
font: inherit;
font-size: 14px;
text-decoration: none;
}
.btn:is(:hover, :focus-visible) {
border-color: #2563eb;
color: #2563eb;
}
.btn.link { border-color: transparent; color: #2563eb; text-decoration: underline; }
.tag {
display: inline-block;
padding: 3px 10px;
border: 1px solid #bfdbfe;
border-radius: 999px;
background: #dbeafe;
color: #1e40af;
font-size: 13px;
}
.tag.accent {
border-color: #fcd34d;
background: #f59e0b;
color: #0f172a;
}
/* 故意写在最后,权重仍是 0 */
:where(.tag) {
border-color: #e2e8f0;
background: #e2e8f0;
color: #0f172a;
}
.hint { margin-top: 12px; color: #64748b; font-size: 12px; }