better-layout
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseLayout that communicates structure
传递结构信息的布局
Layout communicates before a single word is read: position, spacing, and alignment carry hierarchy on their own, and generous space beats decoration. A good layout also survives stress: resize it, translate it, mirror it for RTL, and it should still hold together. Apply these principles when building or reviewing UI code, and express every change in the project's existing styling system (Tailwind, plain CSS, CSS-in-JS); never introduce a second styling approach.
Hit-area sizes and focus behavior are covered by the skill; visual polish (radius, shadows, animation) by the skill; line length and text spacing by the skill.
better-accessibilitybetter-uibetter-typography布局在用户阅读任何文字之前就传递了信息:位置、间距和对齐方式本身就承载着层级关系,充足的留白比装饰更有效。优秀的布局还能应对各种场景变化:调整尺寸、翻译内容、镜像为RTL布局后,仍能保持结构完整。在构建或审核UI代码时应用这些原则,并且所有修改都要基于项目现有的样式系统(Tailwind、纯CSS、CSS-in-JS);切勿引入第二种样式方案。
点击区域尺寸和焦点行为由技能覆盖;视觉优化(圆角、阴影、动画)由技能覆盖;行宽和文本间距由技能覆盖。
better-accessibilitybetter-uibetter-typographyQuick Reference
快速参考
| Category | When to Use |
|---|---|
| Grouping & Alignment | Space vs separators, alignment edges, logical properties, importance ordering |
| Spacing & Adaptivity | Spacing between targets, layout margins, progressive disclosure, full-bleed content, breakpoints, i18n growth |
| 类别 | 适用场景 |
|---|---|
| 分组与对齐 | 留白 vs 分隔符、对齐边缘、逻辑属性、重要性排序 |
| 间距与适应性 | 目标元素间的间距、布局边距、渐进式展示、全屏内容、断点、国际化内容扩展 |
Core Principles
核心原则
1. Group with Space, Not Lines
1. 用留白分组,而非线条
Negative space is the primary grouping tool; background shapes second; separator lines last, only where space alone can't carry the structure. The gap between groups must be at least 2× the gap within a group ( intra-group → + inter-group), or the grouping reads as noise.
8px16px负空间是主要的分组工具;背景形状次之;分隔线仅在留白无法传递结构时使用。组与组之间的间距至少应为组内间距的2倍(组内 → 组间及以上),否则分组会显得杂乱无章。
8px16px2. Keep Controls Distinct from Content
2. 区分控件与内容
Interactive elements must look interactive: a background shape, a border, or a consistent placement zone. Never style a control identically to adjacent static text.
交互元素必须具备交互视觉特征:背景形状、边框或固定的放置区域。切勿将控件设计成与相邻静态文本完全一致的样式。
3. Align to Shared Edges
3. 对齐到共享边缘
Pick alignment edges and stick to them; every stray edge reads as noise. Indent exactly one step () to signal subordination. Use logical properties (, ), never physical left/right, so RTL mirrors for free.
16pxpadding-inline-startmargin-inline-end选定对齐边缘并保持一致;任何偏离的边缘都会显得杂乱。通过精确缩进一级()来表示从属关系。使用逻辑属性(、),切勿使用物理方向的left/right,这样RTL布局可自动适配镜像效果。
16pxpadding-inline-startmargin-inline-end4. Order by Importance
4. 按重要性排序
The most important content sits near the top and the leading edge; reading order flows top-to-bottom, leading-to-trailing. Think in leading/trailing, not left/right.
最重要的内容应位于顶部和起始边缘附近;阅读顺序遵循从上到下、从起始到末尾的逻辑。思考时使用起始/末尾,而非左/右。
5. Hint at Hidden Content
5. 提示隐藏内容
Progressive disclosure needs a visible affordance: let the next item peek past the scroll edge, or show a disclosure control. Content hidden with zero cue may as well not exist.
16–32px渐进式展示需要可见的提示:让下一个元素露出超出滚动边缘,或显示展开控件。没有任何提示的隐藏内容等同于不存在。
16–32px6. Breathing Room Between Targets
6. 目标元素间保留呼吸空间
Keep at least between adjacent bordered or filled controls, and of clearance around borderless text- and icon-only controls. Hit-area sizes themselves are covered by the skill.
12px24pxbetter-accessibility相邻带边框或填充的控件之间至少保留间距,无边框的纯文本和图标控件周围至少保留空白。点击区域尺寸本身由技能覆盖。
12px24pxbetter-accessibility7. Inset Buttons from the Edges
7. 按钮与边缘保持间距
No edge-to-edge, full-width buttons pressed against the viewport. Keep buttons inside the layout margins (at least inline margin on mobile) with a visible radius.
16px不要使用紧贴视口边缘的全宽按钮。按钮应置于布局边距内(移动端至少保留的内联边距),并设置可见的圆角。
16px8. Content Bleeds, Controls Float
8. 内容全屏延伸,控件悬浮于内
Backgrounds and media extend to the viewport edges; controls and text stay inside the layout margins and safe areas (). Sticky chrome floats above the content layer, it doesn't dam it.
env(safe-area-inset-*)背景和媒体可延伸至视口边缘;控件和文本应保持在布局边距和安全区域()内。粘性导航栏悬浮于内容层上方,不应遮挡内容。
env(safe-area-inset-*)9. Hold Structure Until It Breaks
9. 保持结构直至无法承载
Breakpoints come from the content, not device presets. Keep the expanded layout as long as it genuinely fits and collapse late; prefer container queries for component-level adaptation. Test the smallest and largest sizes first.
断点由内容决定,而非设备预设。尽可能保留展开布局,直到内容确实无法容纳再折叠;组件级适配优先使用容器查询(container queries)。优先测试最小和最大尺寸。
10. Plan for Growth and Clipping
10. 为内容扩展和溢出做好规划
Translated strings run 30–40% longer: no fixed widths or heights on text containers, and let rows wrap. Never park critical actions where resizing or scrolling clips them; keep primary actions in stable chrome.
翻译后的字符串长度会增加30–40%:文本容器不要设置固定宽高,允许换行。切勿将关键操作放在调整尺寸或滚动时会被遮挡的位置;将主要操作放在稳定的导航栏中。
Common Mistakes
常见错误
| Mistake | Fix |
|---|---|
| Separator line where spacing would do | Remove the line, double the gap between groups |
| |
| Full-width edge-to-edge button | Inset within layout margins ( |
| Carousel/scroller that looks complete | Let the next item peek |
| Adjacent controls with no gap | |
| Breakpoints at 768/1024 because they're the defaults | Break where the content actually stops fitting |
| Fixed-width text container sized to English strings | |
| Primary action at the clip-prone bottom of a pane | Sticky positioning or stable chrome with safe-area padding |
| 错误 | 修复方案 |
|---|---|
| 可用留白却使用分隔线 | 删除线条,将组间间距加倍 |
可本地化布局中使用 | 替换为 |
| 全宽边缘到边缘按钮 | 缩进至布局边距内(移动端最小 |
| 轮播/滚动容器看起来已完全展示 | 让下一个元素露出 |
| 相邻控件无间距 | 带边框控件间至少保留 |
| 因默认值将断点设为768/1024 | 在内容确实无法容纳时设置断点 |
| 文本容器固定宽度适配英文内容 | 设置 |
| 主要操作位于面板底部易被遮挡 | 使用粘性定位或带安全区域内边距的稳定导航栏 |
Review Output Format
审核输出格式
Present every review in two parts.
所有审核结果分为两部分呈现。
Findings
问题发现
Group findings by principle. Use a markdown table with Severity, Location, Before, After, and Why columns. Include every change made or proposed, not a subset. Never use separate "Before:" / "After:" lines.
- Severity: blocks content or an action at a supported viewport;
HIGHharms hierarchy, reading order, or adaptability;MEDIUMis isolated alignment or spacing polish.LOW - Location: cite . If the artifact has no source files, cite the exact screen and component instead.
path/to/file:line - Before / After: show the current layout and an actionable replacement.
- Why: name the violated principle and its effect on comprehension or adaptability.
Consolidate a repeated systemic issue into one row and list every affected location. Omit principles with no findings.
按原则分组展示问题。使用Markdown表格,包含Severity、Location、Before、After和Why列。列出所有已修改或建议修改的内容,而非部分内容。切勿使用单独的“Before:” / “After:”行。
- Severity:表示在支持的视口下阻塞内容或操作;
HIGH表示损害层级、阅读顺序或适应性;MEDIUM表示孤立的对齐或间距优化问题。LOW - Location:引用。如果没有源文件,则引用具体屏幕和组件。
path/to/file:line - Before / After:展示当前布局和可执行的整改方案。
- Why:指出违反的原则及其对理解或适应性的影响。
将重复的系统性问题合并为一行,并列出所有受影响的位置。没有问题的原则可省略。
Example
示例
Group with space, not lines
用留白分组,而非线条
| Severity | Location | Before | After | Why |
|---|---|---|---|---|
| LOW | | | Remove borders; use | Spacing communicates grouping with less visual noise |
| LOW | | | Replace with | Section hierarchy should not depend on repeated rules |
| Severity | Location | Before | After | Why |
|---|---|---|---|---|
| LOW | | 每个设置行添加 | 删除边框;组内使用 | 留白分组视觉干扰更少 |
| LOW | | 表单区块间使用 | 替换为每个区块标题添加 | 区块层级不应依赖重复的分隔线 |
Align to shared edges
对齐到共享边缘
| Severity | Location | Before | After | Why |
|---|---|---|---|---|
| LOW | | Card text at | Align both to the same | Shared edges create a legible structure |
| MEDIUM | | | | Physical properties break direction-aware layouts |
| Severity | Location | Before | After | Why |
|---|---|---|---|---|
| LOW | | 卡片文本 | 两者均对齐到 | 共享边缘可形成清晰的结构 |
| MEDIUM | | | | 物理属性会破坏方向感知布局 |
Verification and Verdict
验证与结论
After the findings:
- Verification: list the exact checks run and their observed results across the relevant viewport widths, reading order, zoom, and RTL state. If a check was not run, state what still needs verification.
- Verdict: if any
Blockfinding remains,HIGHif onlyNeeds changesorMEDIUMfindings remain, andLOWonly when no actionable findings remain.Approve
When there are no findings, omit the tables, state "No actionable layout findings", report verification, and end with .
Approve问题发现之后:
- Verification:列出执行的具体检查及其在相关视口宽度、阅读顺序、缩放和RTL状态下的观察结果。如果未执行某项检查,说明仍需验证的内容。
- Verdict:若存在未解决的问题则为
HIGH;仅存在Block或MEDIUM问题则为LOW;无待处理问题则为Needs changes。Approve
若无问题,可省略表格,说明“无待处理布局问题”,报告验证情况,最后以结尾。
Approve