BLOG
What Those CSS Numbers Actually Do: A Visual Guide for Non-Coders
You do not need definitions. You need to know which number to change when a card feels cramped, when text feels crowded, or when a button looks cheaper than the rest of the page.
Why definitions don't help
Look up padding and you will find: "the space between an element's content and its
border." Correct, and almost useless when you are staring at a Squarespace card that feels wrong.
The definition tells you what the property is; it does not tell you whether your problem
is padding, margin or gap.
So this article is organised the other way round. For each value: what you see when it changes, and the specific complaint it usually fixes. Everything below is rendered on this page - the before and after are real, not illustrations.
The three spacings, once and for all
Almost every "my layout feels off" question is one of these three, and mixing them up is the most common reason people change a number and see nothing happen.
margin <- space OUTSIDE the box
+---------------------------+
| border |
| +-------------------+ |
| | padding | | <- space INSIDE the box
| | CONTENT | |
| +-------------------+ |
+---------------------------+
gap <- space BETWEEN items in a row or grid
Sunday market
Fresh bread, cheese and flowers, every week from eight.
Sunday market
Fresh bread, cheese and flowers, every week from eight.
Padding grows the box; the text stays where it is relative to the content area.
Margin pushes neighbours away. Inside the card nothing moved.
The complaint-to-property shortcut:
- "The text is touching the edge of the card" →
padding - "These two blocks are glued together" →
margin(orgapif they are grid items) - "My three feature cards are too close but the text inside is fine" →
gap
border-radius: how round is round
One number, and it changes the entire personality of a component. The same button at four values:
0 reads corporate, 4-8 reads neutral, 16-24 reads friendly, 999px is a pill and pulls attention.
The most common unforced error is inconsistency: buttons at 6px on one page and 24px on another. Consistency matters more than the specific number - pick one radius for buttons and one for cards and reuse them.
font-size and line-height: two numbers that must move together
font-size is obvious. line-height is the one people forget, and it is
the difference between text that reads comfortably and text that reads like a wall.
Our studio runs small weekly workshops on ceramics, printing and bookbinding. Places are limited to twelve so everyone gets a bench and a bit of quiet.
Our studio runs small weekly workshops on ceramics, printing and bookbinding. Places are limited to twelve so everyone gets a bench and a bit of quiet.
Same text, same size. Body copy usually wants 1.5 to 1.7; headings want 1.1 to 1.25.
A useful rule of thumb: when you increase font-size, decrease
line-height slightly - large text needs less relative leading. Big headings at
1.7 look disconnected.
letter-spacing: the one people overuse
Small positive letter-spacing (0.02em to 0.08em) on uppercase labels and buttons looks considered. The same value applied to body paragraphs makes them harder to read. All-caps text benefits; sentences do not.
width vs. max-width: the cause of "text spans the whole screen"
width: 900px forces a block to be 900px even on a 390px phone - content overflows and
a horizontal scrollbar appears. max-width: 900px means "never wider than 900, but
shrink if the screen is smaller". For text containers, max-width is almost always
what you wanted.
Related: comfortable reading width is roughly 60 to 75 characters per line. If your paragraphs run
the full width of a wide monitor, the fix is a max-width on the text container, not a
smaller font.
box-shadow: four numbers pretending to be one
box-shadow: 0 8px 30px rgba(0, 0, 0, .08);
| | | |
| | | └── colour and its transparency
| | └─────── blur: how soft the edge is
| └────────── y-offset: how far DOWN the shadow sits
└──────────── x-offset: how far RIGHT the shadow sits
Two practical notes. First, the alpha value (that .08) is the number that separates
professional from amateur - heavy shadows on light backgrounds look dated; .06 to
.12 is the subtle range. Second, a shadow with zero blur and no offset is not a
shadow, it is a hard border - which is sometimes exactly what you want, but rarely what you meant.
Studio visit
Open Saturdays, ten to four.
Studio visit
Open Saturdays, ten to four.
On a dark page the difference is exaggerated; the principle holds - small offsets, generous blur, low alpha.
opacity: the value people reach for instead of a colour
opacity: 0.6 makes an entire element translucent, including its text - which is why
"muted" text set with opacity often fails contrast checks on light backgrounds. If you want a
lighter text colour, set the colour. If you want a translucent panel, use a colour with an alpha
channel (rgba(...)) rather than fading the whole block.
border-width and why 1px is usually right
Borders above 2px start competing with the content for attention. The exception is a deliberate heavy border as a design device. When a card looks cheap, the cause is usually the border colour being too close to the background, not the width being too small.
The twelve values worth knowing
padding- space inside the boxmargin- space outside the boxgap- space between grid or flex itemsborder-radius- how round the corners areborder-width- thickness of the outlinefont-size- size of the textline-height- space between linesletter-spacing- space between charactersmax-width- the upper limit on how wide a block growsbox-shadow- the lift, in four numbersopacity- translucency of the whole elementbackground- fill colour, including transparency
That is genuinely most of what non-developers need for cosmetic work. Notice what is not on the list: no positioning, no flexbox, no grid templates, no media queries. Those are structural, and structural changes are where hiring someone starts to make sense.
The units, without the arithmetic
Numbers in CSS come with a suffix, and the suffix changes what the number means. Four of them cover almost everything a site owner touches:
-
px- absolute. 16px is 16 pixels regardless of context. Predictable and the right choice for borders, radii and small fixed spacing. -
em- relative to the element's own font size.letter-spacing: .05emmeans "5% of this text's size", so it scales if you later change the font size. Use it for spacing that should follow the text. -
rem- relative to the site's root font size. Similar idea, but consistent across the whole page. Good for section spacing you want to feel uniform. -
%- relative to the parent.width: 50%is half of whatever contains it, which is why percentages are the natural unit for columns and whywidth: 100%on an image makes it fill its container.
Two practical rules fall out of this. First, line-height is usually written with no
unit at all - 1.6 means 1.6 times the font size, which is what makes it scale
automatically when you change the type. Second, when a value does not seem to respond, check the
unit before assuming the property is wrong: max-width: 900 does nothing at all,
because CSS needs to know 900 of what.
How to use this page
When something on your site looks wrong, name the complaint first - "cramped", "too sharp", "text runs too wide", "cards too close" - then find it in the list above and change one number. Change one thing, look at the result, then decide. That habit is the whole of A Safer Workflow for Editing Squarespace CSS, and the twelve requests that cover most real sites are listed in The 12 CSS Changes Squarespace Site Owners Make Most Often.
To see a value change on your own markup rather than on this page, paste one section into the CSS Code Editor and adjust there - it renders the section live and gives you the result to copy back. It handles contained sections and controlled edits; it is not a page builder and will not restructure your site.
If your complaint is about images rather than spacing or text, the relevant numbers are different ones - see Image Size vs. Aspect Ratio.
And if the specific confusion is padding versus margin versus gap - the three values that get mixed up most often - that is worth its own explanation.