示例工程 41-has-is-where

41-has-is-where/demo-02-is-where/README.md

markdown · 0.4 KB

运行::is 与 :where

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

# demo-02-is-where

`:is` 合并选择器,`:where` 归零权重。

## 运行

直接打开 `index.html`,悬停按钮与链接。

## 观察

- `:is(h3, h4)` 让两个标题共享左边框
- `:is(:hover, :focus-visible)` 让鼠标与键盘共用状态
- `:where(.tag)` 写在最后仍是灰底,输给前面的 `.tag`
- 这就是「基础样式用 :where,业务样式用类」的由来