# Grouping and alignment Recipes for grouping, control distinction, shared edges, logical properties and ordering. ## Group with space, not lines Reach for each tool only where the one before it can't carry the structure: 1. **Negative space**, the default. 2. **Background shapes**, a card or filled container, where a group must read as one unit such as a selectable row or a draggable card. 3. **Separator lines**, for dense data where space costs too much, such as tables and long settings lists. ```css /* Good: spacing alone communicates the grouping */ .field-group { display: flex; flex-direction: column; gap: 8px; } .form { display: flex; flex-direction: column; gap: 24px; } /* Bad: uniform spacing plus lines to compensate */ .form > * { margin-bottom: 12px; border-bottom: 1px solid var(--separator); } ``` ```html
Your trial ends soon. Upgrade now
Your trial ends soon.
``` The inverse holds too. A non-clickable badge shaped exactly like the buttons beside it collects dead clicks. ## Align to shared edges - Typical stray edges are an icon 2px off the text edge and a card padded unlike its neighbor. - Deeper nesting repeats the same spacing step rather than inventing a new one. - Numbers in tables take `text-align: end`, text takes `text-align: start`. Tabular figures are `better-typography`'s. ```css /* Good: one shared leading edge, one indent step */ .section { padding-inline: 24px; } .section .child { margin-inline-start: 16px; } /* Bad: three unrelated leading edges in one column */ .header { padding-inline-start: 20px; } .list-item { padding-inline-start: 14px; } .footer { padding-inline-start: 24px; } ``` ## Logical properties for anything that mirrors | Physical | Logical | | --- | --- | | `margin-left` | `margin-inline-start` | | `padding-right` | `padding-inline-end` | | `left: 0` | `inset-inline-start: 0` | | `text-align: left` | `text-align: start` | | `border-right` | `border-inline-end` | | `float: left` | `float: inline-start` | | `border-top-left-radius` | `border-start-start-radius` | ```html$4,320.00
Available balance
Account 4402 · Opened 2019 · Standard tier
Last statement: June 30
Balance: $4,320.00