示例工程 01-what-is-css

01-what-is-css/app/README.md

markdown · 0.8 KB

运行:林小满 · 前端学习者

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

# 01-what-is-css / app

个人名片页:一份 HTML + 一份 CSS,无 JavaScript、无外部资源。
演示「结构相同,样式决定外观」。

## 运行

```bash
cd tutorials/css
python3 -m http.server 8080
# 打开 http://127.0.0.1:8080/examples/01-what-is-css/app/
```

也可以直接双击 `index.html`。

## 结构

- `index.html`:语义结构(main / article / h1 / ul / a)
- `style.css`:设计 token、布局、卡片、响应式与 reduced-motion

## 关键点

- `box-sizing: border-box` 让 padding 不撑大卡片
- `display: grid` + `place-items: center` 做页面居中
- `clamp()` 让标题在窄屏也保持可读
- 520px 以下卡片改为单列
- 焦点环与 reduced-motion 是基线,不是可选项

## 已知限制

- 头像用文字与渐变,不包含图片加载示例
- 未使用容器查询与嵌套,后续章节展开