示例工程 01-what-is-css

01-what-is-css/demo-02-first-rule/README.md

markdown · 0.4 KB

运行:第一条 CSS 规则

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

# demo-02-first-rule

两条规则:`body` 设置全局字体与背景,`.highlight` 选中一个段落并改变颜色、边框与内边距。

## 运行

直接打开 `index.html`。

## 观察

- 删除 `.highlight` 规则,第二段会回到默认样式
- 把 `.highlight` 改成 `p`,两段都会变
- 选择器决定「谁被选中」,声明块决定「变成什么样」