Sub topic 2
Size: bigger elements are seen first
This chapter covers size as a visual cue. It assumes you know basic HTML (headings, paragraphs, links, buttons) and basic CSS (selectors, properties, custom properties, the box model). It also assumes you have seen how a typical page is laid out: a header, a main column, and some supporting content.
By the end you should be able to explain why size draws the eye, choose size differences that readers can perceive, and spot the common mistakes that flatten or confuse a hierarchy.
Why size works
Visual hierarchy is the order in which a page's elements draw attention. Size is the most direct cue for that order. A larger element covers more of the screen, so it is more likely to fall in a reader's gaze before anything else. Readers also tend to treat size as a statement of importance. A big heading says "start here," and small print says "this is optional or secondary."
Size works before anyone reads a word. A visitor scanning a page picks out the large shapes first and builds a rough outline from them. If the outline matches the real structure of the content, the page feels easy to use. If it does not, readers have to work to find what they came for.
Size is relative. A 24px heading looks large beside 16px body text and small beside a 64px hero headline. What matters is the ratio between neighboring elements, not the absolute value. Two ideas follow from this:
- A size only signals importance when something smaller sits near it for comparison.
- Making everything larger does not make anything stand out. It only shifts the baseline.
What "size" covers
On a web page, size is more than font size. These properties all change how much visual area an element takes:
| Property | Typical effect on attention |
|---|---|
| `font-size` | Larger text reads as a heading or key message |
| `font-weight` | Heavier strokes add visual mass without changing line height |
| Image or media dimensions | A large image dominates the area around it |
| Padding and element dimensions | A large button or card claims more of the layout |
| Surrounding white space | Empty space around an element increases its apparent size |
This chapter focuses on text size, because typography carries most of the structure of a page. The other properties follow the same rule: the relative difference is what readers perceive.
How big a difference is enough
Small differences in size read as mistakes, not as intent. If a heading is 17px and the body text is 16px, readers may not notice the heading is different at all. They may only sense that something is slightly off. A difference should be large enough to be clearly deliberate.
There is also an upper limit. If a heading is ten times the size of the text under it, the two feel disconnected and the large element swallows the page. For most interfaces, adjacent levels work well when each step is a noticeable multiple of the previous one. A ratio between about 1.2 and 1.5 per step covers a wide range of designs, and the next section shows how to apply that systematically.
Building a consistent type scale
Choosing heading sizes one at a time leads to arbitrary values such as 22px, 27px, and 34px that have no relationship to each other. A type scale fixes this. A modular type scale starts from a base size and multiplies it by a fixed ratio for each step up. The result is a small set of sizes that relate to each other in a predictable way.
The scale below uses a base of 1rem and a ratio of 1.25. Each step is the previous step multiplied by 1.25, rounded to three decimals.
| Step | Calculation | Size |
|---|---|---|
| 0 | 1 | 1rem |
| 1 | 1 × 1.25 | 1.25rem |
| 2 | 1.25 × 1.25 | 1.563rem |
| 3 | 1.563 × 1.25 | 1.953rem |
| 4 | 1.953 × 1.25 | 2.441rem |
At the browser's default of 16px, these come to 16px, 20px, 25px, 31px, and 39px.
CSS custom properties are a good place to hold the scale. You define each step once and refer to it by name, so a change to the scale happens in one place.
:root {
--step-0: 1rem;
--step-1: 1.25rem;
--step-2: 1.563rem;
--step-3: 1.953rem;
--step-4: 2.441rem;
}
body { font-size: var(--step-0); line-height: 1.5; }
h3 { font-size: var(--step-1); }
h2 { font-size: var(--step-2); }
h1 { font-size: var(--step-4); line-height: 1.15; }Notice what this code does and does not do:
- Body text uses step 0, and
h3,h2, andh1use steps 1, 2, and 4. Step 3 is left unused here. You do not have to use every step. It is available for a lead paragraph or a section title that needs to sit betweenh2andh1. - The
h1line height is tighter (1.15) than the body (1.5). Large text needs less line spacing than small text, because the gaps between lines look bigger as the letters grow. - Sizes are in
rem, so they scale if the user changes the default font size in their browser. Usingpxfor text would override that preference.
Choosing a ratio
The ratio sets how dramatic the hierarchy is. Smaller ratios give a quiet, dense look. Larger ratios give stronger separation.
| Ratio | Name often used | Feel |
|---|---|---|
| 1.125 | Major second | Subtle, suited to dense interfaces such as dashboards |
| 1.25 | Major third | Balanced, a common default for content sites |
| 1.333 | Perfect fourth | Clear separation, good for marketing pages |
| 1.5 | Perfect fifth | Strong contrast, steps grow fast |
A high ratio has a cost. The sizes grow geometrically, so five steps at 1.5 reach about 7.6 times the base. That is too large for most small screens, which is one reason the scale needs adjusting on narrow viewports. Chapter content later in this tutorial covers that adjustment.
Size does not work alone
Size is one cue among several. A heading that is only slightly larger than the body can still stand out if it is bold, dark, and has space above it. Likewise, a large heading in pale gray on white may be big but still weak, because contrast is low. Later chapters cover contrast and position in detail. For now, keep in mind that the size you choose is a starting point, not the full answer.
The reverse also holds. If you rely on bold weight and color alone to mark headings while keeping the size the same as the body, the structure is harder to scan at a glance. Size is the cue readers can pick up from the greatest distance and with the least effort, so it usually carries the main levels of the hierarchy.
Size beyond text
Text is the usual case, but the same logic applies to other elements. A call-to-action button is a good example. The button's padding and font size set how much room it claims. Compare two buttons:
.button {
padding: 0.6rem 1.2rem;
border-radius: 4px;
font: inherit;
cursor: pointer;
}
.button--primary {
background: #0b57d0;
color: #ffffff;
border: 2px solid #0b57d0;
font-weight: 700;
}
.button--secondary {
background: transparent;
color: #0b57d0;
border: 2px solid #0b57d0;
font-weight: 400;
}In this example both buttons share the same padding, so the difference between them comes from fill and weight. You could add size to the mix by giving the primary button more padding or a larger font. Be careful if you do. Buttons of different heights placed side by side look misaligned, and a very large button can look like a banner and not an action. Often the better approach is to keep sizes equal and vary another cue, which later chapters discuss.
Common mistakes
These problems appear often in real pages.
- Too many sizes. A page with eight or nine distinct font sizes has no clear levels. Readers cannot tell which differences mean something. Stick to the steps in your scale, and aim for roughly four to six sizes in use on a given page.
- Steps too close together. Sizes that differ by one or two pixels look accidental. Increase the ratio or remove one of the levels.
- Size used to shout. If every heading, badge, and banner is large, no single element leads. Reserve the largest size for the one thing a reader should see first.
- Headings chosen for size, not meaning. Picking an
h4because it looks right, or anh1for visual effect, breaks the document outline for assistive technology. Choose the element for its meaning, then set its size with CSS. A heading level and its visual size are separate decisions. - Fixed pixel sizes. Text set in
pxignores the user's browser font setting. Useremfor type and let the scale follow the user's preference. - Tiny supporting text. Captions and legal notes are meant to be secondary, but text below about 12px to 14px becomes hard to read for many people. Make it smaller than body text, but only slightly.
Edge cases
A few situations need extra care.
- Long headings. A large size that works for a three-word title can wrap across four lines for a long one. Test with real content, not placeholder text. A large heading that wraps awkwardly weakens the hierarchy it was meant to create.
- Different scripts. Some writing systems look larger or smaller at the same font size because of how their letters are drawn. A size that feels balanced in Latin text may look too small in another script. Check the languages your site supports.
- Different fonts. Fonts with a large x-height, which is the height of lowercase letters, look bigger than fonts with a small one at the same
font-size. If you change typefaces, review the scale again. - User zoom and text scaling. Readers may enlarge text to 200 percent. Because a
remscale scales together, the relative differences hold. Fixed pixel sizes mixed withremones break those relationships.
A simple diagram of the scale
The diagram below shows how a single base size and one ratio produce every heading level.
Summary of working rules
- Size is relative. Plan the ratio between neighbors, not isolated values.
- Make the differences between levels clearly visible, but not extreme.
- Generate sizes from a scale and store them as custom properties.
- Use
remfor text, and keep heading elements chosen by meaning. - Limit the number of sizes in use, and give the largest size to one element per view.
Exercise
A page uses body text at 1rem and sets its section headings at 1.05rem in bold. Readers say they cannot tell where sections begin. Using the 1.25 scale from this chapter, what would you change, and why is bold weight alone not enough here?
Show answer
Set the section headings to a step of the scale that is clearly larger than the body, such as step 2 (1.563rem), so the headings are at least a full step or two above the 1rem body text. A 5 percent size difference looks accidental, and bold alone adds only a small amount of visual mass. Size is the cue readers notice from furthest away, so it should carry the main level. Weight can then support it as a secondary cue.
Exercise
Starting from a base of 1rem and a ratio of 1.333, calculate steps 1, 2, and 3 (round to two decimals). Then explain one downside of using a larger ratio such as 1.5 on small screens.
Show answer
Step 1 is 1 × 1.333 = 1.33rem. Step 2 is 1.333 × 1.333 ≈ 1.78rem. Step 3 is 1.78 × 1.333 ≈ 2.37rem. With a ratio of 1.5, the steps grow quickly, and the top steps (for example about 3.4rem at step 3 and about 5.1rem at step 4) become too large for narrow screens. Headings can wrap onto many lines or crowd out the content, so the scale needs a smaller ratio or smaller top steps on small viewports.