CSS 参考
CSS 选择器、display、盒模型、Flexbox、Grid、position,以及排版、文本、颜色、背景、边框、尺寸与 overflow 的速查参考页。这些页面补充 CSS 教程,并不取代教程。正文目前为英文。
参考页正文目前为英文。
需要循序说明时先看教程;需要语法、初始值、作用条件和边界时再打开参考页。示例是完整的 HTML 与 CSS 片段,并用 CSS 解析器做了结构检查,但并未在浏览器中渲染。
| Topic | What it covers |
|---|---|
| Selectors | Quick reference for CSS selectors: common patterns, specificity, and the :is, :where, and :not rules, complementary to the CSS tutorial. |
| Display | Quick reference for CSS display: outer and inner display roles, common keywords, and how display: none differs from visibility. |
| Box model | Quick reference for the CSS box model: box-sizing calculations, padding, border, margin, and when vertical margins collapse. |
| Flexbox | Quick reference for CSS Flexbox: main and cross axes, default alignment, gap, and why flex items default to min-width: auto. |
| Grid | Quick reference for CSS Grid: track sizing, why 1fr is minmax(auto, 1fr), minmax(0, 1fr), and auto-fit versus auto-fill. |
| Position | Quick reference for CSS position: static, relative, absolute, sticky, and fixed, including sticky inset and overflow, and why absolute is not always relative to the parent. |
| Typography | Quick reference for CSS font families, font-size, line-height, the font shorthand, and the limits of font loading on this site. |
| Text | Quick reference for CSS text-align, wrapping, overflow-wrap versus word-break, and the conditions required for text-overflow. |
| Colors | Quick reference for CSS color syntax, alpha, currentColor, and how opacity differs from a transparent color and from hiding interaction. |
| Backgrounds | Quick reference for CSS background-color, layers, position, size, and using a gradient instead of a network image. |
| Borders | Quick reference for CSS borders, border-radius, and outline, including layout size and focus visibility. |
| Sizing and overflow | Quick reference for CSS width, height, min/max sizes, percentage heights and the containing block, and overflow including clip versus hidden. |