MCPInstall

sizing-units

rem, px or relative units for each kind of value. Use when defining spacing and sizing tokens, control heights or media queries, or when a layout breaks under enlarged text.

Installs
274
Last 24h
+8
Trending rank
#9498
Security
Not audited

Install

Works with every agent the skills CLI supports.

npx skills add https://github.com/dembrandt/dembrandt-skills --skill sizing-units
  1. 01

    Install

    Run the command in your project. The CLI asks which agents to install for.

  2. 02

    Describe the task

    Ask your agent for something this skill covers. It loads sizing-units automatically when relevant.

  3. 03

    Review the result

    The agent follows the SKILL.md steps, scripts and references bundled with the skill.

SKILL.md

The instructions your agent reads when the skill is triggered.

Sizing Units

The Question the Unit Answers

A unit is not a formatting preference. It is a declaration of what happens to a value when the user enlarges text.

  • rem — this value belongs to the text and must grow with it.
  • px — this value belongs to the screen and must stay put.
  • %, fr, ch, clamp(), min() — this value belongs to the available space.

Pick the unit by answering that question, not by picking a house style and applying it everywhere. Both absolutist positions — all-rem and all-px — produce defects, and they are different defects.

Zoom Is Not the Font-Size Setting

The common argument for px everywhere is that browsers already have full-page zoom, so the root font size can be ignored. They are separate controls serving separate people.

  • Full-page zoom magnifies everything, layout included. It buys larger text at the cost of horizontal scrolling and fewer items per screen.
  • The browser's default font size enlarges text and leaves the layout alone. This is what a user with low vision sets once, years ago, and never touches again. They will not switch to zoom because your product ignored it.

A product that hard-codes every dimension in px answers the first user and silently refuses the second. WCAG 2.2 SC 1.4.4 (Resize Text) requires text to reach 200% without loss of content or function, and SC 1.4.10 (Reflow) requires the page to survive it in a single column. See [[wcag-accessibility]].

Use rem For

Typography. Every font size and line height. See [[modular-scale-typography]].

Padding around text. A button's inner padding in px means large text presses against its edges. In rem the breathing room scales with the words it surrounds.

Control heights. A 40px control holding 24px text is broken. Write the height token in rem and it stays a control-shaped control at every text size. See [[component-family-consistency]].

Measure. max-width on a text column: 65ch or a rem value, never px.

Gaps between text-bearing blocks. Stack spacing in a form or an article is part of the reading rhythm.

Use px For

Hairlines and borders. 1px is one device pixel by intent. In rem it becomes 1.25px at a larger root size and renders as a blurry smear.

Shadow offsets and blur. Elevation is a screen-space effect. See [[elevation-and-depth]].

Small icons inside controls where the icon is a fixed glyph rather than text.

Sub-pixel corrections — the -1px that makes two borders overlap instead of doubling.

Use Relative Units For

Layout widths and gaps. This is where the "lock it in px so it stays stable" instinct goes wrong: a px-locked container is not stable, it is brittle. The text inside it still grows, and a fixed box is exactly what makes growing text clip.

/* Brittle — the box cannot absorb anything */
.card   { width: 320px; height: 180px; }
.sidebar { width: 280px; }

/* Resilient */
.card    { max-width: 20rem; min-height: 11.25rem; }
.sidebar { width: clamp(16rem, 22%, 22rem); }

min-height, never height, on anything containing text. A fixed height cannot grow; a minimum height holds the shape at rest and yields when it must.

Media Queries

Use em in media queries. Media-query rem and em both resolve against the browser's default font size, ignoring any html { font-size } you set — so em is the honest spelling, and both respect the user's preference where a px breakpoint does not. A user with a large default font size gets the layout their effective text size warrants, not the one their device width claims.

@media (min-width: 48em) { /* ~768px at default settings */ }

Do Not Reset the Root

html { font-size: 62.5%; } /* Do not do this */

The 62.5% trick exists to make rem arithmetic easy — 1.6rem for 16px. It buys you mental arithmetic and pays for it by overriding the user's stated preference by default. Keep the root at the browser default and let the tooling do the division.

A Measured Container Must Not Depend on What It Sizes

When script sizes an element from its container, the container's size must be definite and independent of that element on every breakpoint. If the container shrink-wraps the child, the measurement reads the child's own collapsed size and the element stays collapsed, silently, on the breakpoints where the chain loses its definite size. Give the chain a definite size down to the measured box and observe the box itself, not window events.

Review Checklist

  • Is every font size, line height, and text-adjacent padding in rem?
  • Are borders, hairlines, and shadow offsets in px?
  • Does any element containing text use height rather than min-height?
  • Are container widths relative (%, fr, clamp(), max-width) rather than fixed px?
  • Are media-query breakpoints in em?
  • Is html { font-size } left at the browser default?
  • At a 200% browser font-size setting, does every control still contain its label, with no clipping and no horizontal page scroll?
  • Is every script-measured container sized by layout rather than by the child it sizes?

FAQ

What does the sizing-units skill do?

rem, px or relative units for each kind of value. Use when defining spacing and sizing tokens, control heights or media queries, or when a layout breaks under enlarged text.

How do I install sizing-units?

Run npx skills add https://github.com/dembrandt/dembrandt-skills --skill sizing-units in your project. The skills CLI detects the agents you use and copies the skill into the right folder. For Claude Code you can also place the skill folder at ~/.claude/skills/sizing-units/ (personal) or .claude/skills/sizing-units/ (project).

Which AI agents can use sizing-units?

Any agent that supports the open Agent Skills format (a folder with a SKILL.md file), including Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf, Cline, OpenCode and more.

Is sizing-units safe to install?

No partner security audit is available yet. Skills can run commands and scripts, so read the SKILL.md and any bundled files before installing.

Who maintains sizing-units?

It is published by dembrandt in dembrandt/dembrandt-skills. It has 274 recorded installs.

More from dembrandt/dembrandt-skills

View all →

nielsen-usability-heuristics

dembrandt/dembrandt-skills

Nielsen's 10 usability heuristics. Use when auditing an interface, designing interaction flows, writing error messages or reviewing usability.

Docs & Writing989 installs

performance-and-web-vitals

dembrandt/dembrandt-skills

Lighthouse audits and Core Web Vitals — LCP, CLS, INP. Use when optimising page load, layout shift, input delay, images, fonts or render-blocking resources.

color-mode-and-theme

dembrandt/dembrandt-skills

Light, dark or both, and when a theme selector is worth it. Use when defining a base palette or deciding on dark mode support.

Frontend & Design940 installs

ui-density

dembrandt/dembrandt-skills

Match information density to platform and user type. Use when designing data tables, dashboards or toolbars, or adapting a desktop product for mobile.

Frontend & Design927 installs

form-design

dembrandt/dembrandt-skills

Helper text, placeholders, validation and submit behaviour. Use when designing or reviewing a form, input field or data entry UI.

Frontend & Design925 installs

brand-visual-language

dembrandt/dembrandt-skills

Shape language across type, radius and icons carries brand personality. Use when starting a design system, picking icons or radius tokens, or reviewing visual consistency.

Marketing & SEO915 installs

Popular frontend & design skills

View category →

setup-matt-pocock-skills

mattpocock/skills

Configure this repo for the engineering skills: set up its issue tracker, triage label vocabulary, and domain doc layout. Run once before first use of the other engineering skills.

Frontend & Design1.1M installs

frontend-design

anthropics/skills

Guidance for distinctive, intentional visual design when building new UI or reshaping an existing one. Helps with aesthetic direction, typography, and making choices that don't read as templated defaults.

OfficialFrontend & Design1M installs

hyperframes-animation

heygen-com/hyperframes

All animation knowledge for HyperFrames — atomic motion rules, multi-phase scene blueprints, scene transitions, broader motion-design techniques, AND the seven runtime adapters (GSAP default, plus Lottie, Three.js, Anime.js, CSS keyframes, Web Animations API, TypeGPU). Use for any motion or animation task: pick 2-4 rules and compose, or load a blueprint, or look up runtime-specific API (e.g. GSAP eases / Lottie player / Three.js mixer). Also covers auditing an existing composition's choreography (animation map) and 24 named text-animation effects. HyperFrames-native: single paused timeline, seek-safe, deterministic.

prototype

mattpocock/skills

Build a throwaway prototype to answer a design question. Use when the user wants to sanity-check whether a state model or logic feels right, or explore what a UI should look like.

Frontend & Design999.2K installs

hyperframes-core

heygen-com/hyperframes

The HyperFrames composition contract — build one renderable project. Use for composition structure, the data- timing attributes, class="clip", tracks, sub-compositions, variables, framework-owned media playback, deterministic-render rules, and validation. Read before writing composition HTML.

Frontend & Design930.5K installs

vercel-react-best-practices

vercel-labs/agent-skills

React and Next.js performance optimization guidelines from Vercel Engineering. This skill should be used when writing, reviewing, or refactoring React/Next.js code to ensure optimal performance patterns. Triggers on tasks involving React components, Next.js pages, data fetching, bundle optimization, or performance improvements.

OfficialFrontend & Design843.1K installs