做产品 PMaker
空格的键盘
每处现拍一个
项目详情
改稿记录
11 · 7 · 13 · 9 · 6 · 15
全部来自同一组
项目详情
改稿记录
8 · 8 · 24 · 8 · 8 · 16

右边只用了 8、16、24 三个值。差别不在某一处,在整体的秩序感。

One Spacing Scale

Every spacing value on the page comes from a single fixed set. Once it's set, spacing is no longer a decision you make each time.

What you'll run into
  • 页面说不上哪里不对,就是有点乱
  • 两个模块的内边距差 2px,看着别扭但找不到原因
  • 让 AI 改一处间距,它顺手把别处也改了,值还都不一样

Eyeballed spacing produces a pile of near-but-not-equal values: 11, 13, 14, 15. The differences are too small to look deliberate, but large enough to be felt. The result is a vague sense of "a bit messy" that no one can pin down.

With a fixed set of values, spacing differences become meaningful signals: 8 means tightly related, 24 means these are two different groups. This is the law of proximity landed in numbers.

How to pick the set

值用在哪典型场景
4元素内部图标和它的文字之间、标签的内边距
8紧密相关的两项标题和它的正文、表单标签和输入框
16同一组内的条目列表项之间、卡片的内边距
24组与组之间两个区块之间、卡片之间
40 / 64大区块和页面边距页面顶部留白、章节之间
A base of 4 or 8 both work; the point is to have only one set across the whole site. Multiples of 4 are more flexible, multiples of 8 are more uniform. On mobile, where the screen is small, 4 is the usual starting point.

Five to six values is enough. More is the same as none, because you can always find a "roughly right" one; fewer and you'll run short and be forced to break the rule.

同样五个元素,间距取值不同,读出来的关系就不同 随手定的 ↕ 13 ↕ 11 ↕ 15 ↕ 14 差别小到看不出是故意的,大到能被感觉到 结果就是「有点乱」,但说不清哪里乱 一套固定值 ↕ 8 ↕ 8 ↕ 24 ↕ 8 8 表示紧密相关,24 表示这是两个不同的组 间距的差别变成了有意义的信号 相邻两级至少差 1.5 倍:8 和 24 一眼能看出来,8 和 12 就模糊了。竖向间距比横向更要紧,人是纵向扫页面的。
A base of 4 or 8 both work; the point is to have only one set across the whole site. Multiples of 4 are more flexible, multiples of 8 are more uniform. On mobile, where the screen is small, 4 is the usual starting point.

How to use it

Note for the AI

CLAUDE.md · spacing spec
## 间距

全站间距只能取这组值,不允许出现其他数字:
4 / 8 / 16 / 24 / 40 / 64(单位 px)

用法:
- 4 元素内部,比如图标和文字之间
- 8 紧密相关的两项,比如标题和它的正文
- 16 同组条目之间、卡片内边距
- 24 组与组之间、卡片之间
- 40 / 64 大区块之间、页面上下边距

要求:
- 定义成 CSS 变量(--sp-1 到 --sp-6),
  组件里引用变量,不要写具体数值。
- 如果某处你认为需要表里没有的值,先告诉我原因,
  不要自己取一个中间值。
- 已有代码里出现表外的间距值时,主动指出来。

The last line is genuinely useful. Having the AI run a quick health check is much faster than inspecting each value yourself.