Inputs
--space-10.25rem; /* 4px */
Ready
Padding that is 13px next to a 16px button is how a layout starts to look slightly drunk. A spacing scale picks a base and a multiplier and sticks to the products. This page writes custom properties, --space-1 onward, in rem, with the pixel value in a comment so you can see both. The opening base is 4px, the factor is 2, there are 6 steps, and the root is 16px. That produces 4, 8, 16, 32, 64, and 128 pixels, written as 0.25rem through 8rem.
A factor of 2 gets large quickly. Step 6 at 128px is a section gap, not a gap between a label and a field. If you wanted 4, 8, 12, 16, 24, 32, that is not a single ratio, and this page will not invent one. Lower the factor, or take the first few steps and write the in-between values yourself. The type-scale page is the same kind of ladder for font sizes, opening at 16px and a 1.25 ratio, which is a much gentler climb.
The root font size is only the divisor that turns pixels into rem. If your document root is 16px, the comments match what the browser will compute. If a user or a reset changes the root, the rem values follow and the pixel comments stay as the design-time note.
Base 4, factor 2, 6 steps, root 16.
:root { --space-1: 0.25rem; /* 4px */ --space-2: 0.5rem; /* 8px */ --space-3: 1rem; /* 16px */ --space-4: 2rem; /* 32px */ --space-5: 4rem; /* 64px */ --space-6: 8rem; /* 128px */ }
Oddsock runs this in your browser. It is free, it does not upload the work, and it does not ask for an account.
Because a factor of 2 compounds. From 4px, six steps lands on 128px. Use that for page sections, or lower the factor if every step should be a component space.
Not from one ratio. Those steps mix adding and multiplying. Generate the geometric subset you like and hand-write the exceptions.
The rem numbers. The pixel comments stay on the design sizes. A root of 16 makes 16px equal 1rem. A root of 10 makes the rem figures larger for the same pixels.
Same ladder math, different job and different opening numbers. Type opens at 16px with a 1.25 ratio. Spacing opens at 4px with a ratio of 2.
No. You paste them into a stylesheet and use them as padding, gap, and margin. The page only writes the list.