算法艺术创作
algorithmic-art
通过代码和可调参数创作生成艺术与交互式视觉效果。
proximity-data-tables【设计与创意】Use this skill when designing or fixing data tables and tabular layouts — row spacing, column spacing, header treatment, group separators, total rows, sticky headers, dense vs. comfortable variants. Trigger when the user is laying out a table, deciding density, debugging "rows that are hard to follow," picking when to add zebra striping, or arguing f…
独立 GitHub 快照 · 自动分类 · 以原作者文档为准
proximity; read that first if you haven''t already.'Tables stress proximity in two directions at once: rows should read as discrete records (vertical proximity binding cells of the same row, separating them from cells of neighbor rows), and columns should read as semantic groupings (horizontal proximity within a column header, between header and cells). Most table problems are proximity problems disguised as styling problems.
In a table, you're managing two perpendicular spacing systems:
Vertical:
Inside a row (cell padding) — ~12-16px
Between rows — ~0 (or thin border for separation)
Header to first row — slightly more than between rows
Footer / total row — distinctly more than between rows
Horizontal:
Within a cell (text to edge) — ~12-16px
Between columns — ~0 (cell border or just padding)
Numeric columns: tabular-nums + right alignment for column-internal proximity
The classic mistake is uniform padding everywhere — every gap the same — so the eye can't tell rows from columns from groups.
Tables come in two density modes; pick deliberately:
Comfortable (default for most apps):
Cell padding: py-3 px-4 (12px / 16px)
Row height: ~48px
Best for: moderate datasets, mixed user proficiency
Dense (power-user / spreadsheet-like):
Cell padding: py-1.5 px-3 (6px / 12px)
Row height: ~32px
Best for: high-frequency scanning, expert users, datasets >50 rows visible
Don't mix densities in the same table. Don't try to be "compact but readable" with mid-sized padding — it ends up neither dense enough for power users nor comfortable enough for casual ones.
The header should bind to its column (vertically tight to the column it labels) but separate clearly from the data rows.
<style>
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 0.75rem 1rem; text-align: left; }
.table th {
font-size: 0.75rem;
font-weight: 600;
color: hsl(0 0% 35%);
text-transform: uppercase;
letter-spacing: 0.04em;
border-bottom: 1px solid hsl(0 0% 88%); /* separates header from data */
padding-bottom: 0.5rem; /* tighter to the underline */
}
.table td { border-bottom: 1px solid hsl(0 0% 95%); } /* very subtle row separator */
.table tbody tr:hover { background: hsl(0 0% 98%); }
</style>
<table class="table">
<thead>
<tr>
<th>Customer</th>
<th style="text-align: right;">Amount</th>
<th style="text-align: right;">Days late</th>
<th>Status</th>
</tr>
</thead>
<tbody>
<tr>
<td>Acme Co.</td>
<td style="text-align: right; font-variant-numeric: tabular-nums;">$2,480.00</td>
<td style="text-align: right; font-variant-numeric: tabular-nums;">14</td>
<td><span class="badge badge-warning">Pending</span></td>
</tr>
<!-- … -->
</tbody>
</table>
The header sits in its own row, visually distinct (smaller, uppercase, lower contrast, with a stronger underline). Data rows have a subtle hairline separator that suggests row boundaries without dominating.
Numbers in a column should align within the column, so the eye can scan vertically and compare magnitudes:
font-variant-numeric: tabular-nums) so digits occupy equal width. Without this, "1,000" and "9,999" don't align by digit position.<td style="text-align: right; font-variant-numeric: tabular-nums;">$2,480.00</td>
<td style="text-align: right; font-variant-numeric: tabular-nums;">$10.00</td>
<td style="text-align: right; font-variant-numeric: tabular-nums;">$98,001.50</td>
Now the eye can scan the column and see magnitude differences instantly.
When rows belong to logical groups (orders by month, projects by team, transactions by status), encode the grouping with a visible gap and an optional sub-header — not by adding a heavy border:
<table class="table">
<thead>…</thead>
<tbody>
<tr class="group-header">
<td colspan="4">May 2026</td>
</tr>
<tr><td>…</td>…</tr>
<tr><td>…</td>…</tr>
<tr class="group-header">
<td colspan="4">April 2026</td>
</tr>
<tr><td>…</td>…</tr>
<tr><td>…</td>…</tr>
</tbody>
</table>
<style>
.group-header td {
font-size: 0.75rem;
font-weight: 600;
color: hsl(0 0% 35%);
background: hsl(0 0% 97%);
padding-top: 1rem; /* extra space above this row separates groups */
padding-bottom: 0.5rem;
}
</style>
The extra top padding on group headers creates a perceptual gap; the slight background tint reinforces it. The user reads months as groups, transactions as group members.
Total rows should bind to the data they summarize (close vertically) and stand out from regular rows (heavier weight, possibly a top border):
<tfoot>
<tr style="font-weight: 600; border-top: 2px solid hsl(0 0% 88%);">
<td>Total</td>
<td colspan="2" style="text-align: right; font-variant-numeric: tabular-nums;">$24,800.00</td>
<td></td>
</tr>
</tfoot>
The 2px top border separates the summary from data rows. Bold weight signals "this is summary, not a regular row." Same column alignment as the data above.
Use sparingly. Zebra striping helps the eye track across very wide rows (~7+ columns) but adds visual noise to compact tables.
hsl(0 0% 98%) against white — visible but not distracting. Anything stronger competes with the data.proximity (parent).proximity-form-fields — same principle on input layouts.hierarchy-typographic — header styling lives at the intersection of hierarchy and proximity.signal-to-noise-ratio — tables are a primary case for SNR discipline.legibility — tabular numerals and alignment are legibility decisions as much as proximity ones.