Sub topic 9
Touch targets and spacing
A mouse pointer is a single pixel. A finger is not. On a phone, the size of a control and the space around it decide whether people can use your page without errors. This chapter covers how to size and space tappable elements, which errors to avoid, and how to check your work.
It assumes you know basic HTML, the CSS box model and units, and how to open browser developer tools. It builds on the navigation patterns from the previous chapter, because navigation links are the most common small targets on a page.
Why target size matters
A touch target is the area of the screen that responds when a user taps. It includes links, buttons, form fields, checkboxes, and any element with a click handler.
The average adult fingertip pad is roughly 10 mm wide. Touch is also imprecise. The finger covers the thing it is pointing at, the thumb swings in an arc, and people tap while walking or on a moving bus. Small targets lead to two kinds of failure:
- Missed taps: the user taps and nothing happens, or the tap lands on empty space.
- Wrong taps: the user hits a neighbouring control, such as "Delete" instead of "Edit".
Wrong taps are worse, because they can trigger actions the user did not intend. Both failures hurt more for people with tremors, limited dexterity, or who use one hand. Large targets help everyone, not only users with accessibility needs.
Recommended sizes
Different guidelines give slightly different numbers. They agree on the order of magnitude.
| Source | Guidance |
|---|---|
| WCAG 2.2, Target Size (Minimum), level AA | At least 24 by 24 CSS pixels, or enough spacing around smaller targets |
| WCAG 2.2, Target Size (Enhanced), level AAA | At least 44 by 44 CSS pixels |
| Apple Human Interface Guidelines | 44 by 44 points |
| Material Design | 48 by 48 dp, with about 8 dp between targets |
A practical rule: aim for about 44 to 48 CSS pixels in both directions for primary controls, and treat 24 pixels as an absolute floor for dense interfaces. CSS pixels are not physical pixels. The browser scales them by the device pixel ratio, so 44 CSS pixels is a similar physical size on most phones.
The size applies to the tappable area, not the visible graphics. A 16-pixel icon can have a 44-pixel target if padding extends the clickable region.
Making a target larger without changing its look
The most common mistake is sizing the text and forgetting the box around it. An inline link only covers its text, so a short word in 16-pixel type produces a target about 20 pixels tall.
The navigation example from the plan fixes this by making the link a flex container with minimum dimensions:
.site-nav a {
display: inline-flex;
align-items: center;
min-block-size: 44px;
min-inline-size: 44px;
padding-inline: 1rem;
}Each property has a job:
display: inline-flexlets the link take a height, which a plain inline element ignores.align-items: centerkeeps the label vertically centred in the taller box.min-block-sizeandmin-inline-sizeset the floor. These are logical properties: they map to height and width in horizontal writing modes, and swap in vertical ones.padding-inlineadds horizontal room so short labels such as "Home" are not squeezed.
Use min- rather than a fixed size. If the user increases their font size, the link can grow past 44 pixels instead of clipping its text.
Icon-only buttons
Icons are a frequent offender. A 24-pixel icon alone fails the enhanced guideline. Pad the button, not the icon:
.icon-button {
display: inline-grid;
place-items: center;
min-inline-size: 44px;
min-block-size: 44px;
padding: 0;
border: 0;
background: transparent;
}
.icon-button svg {
inline-size: 24px;
block-size: 24px;
}An icon-only button also needs an accessible name, such as aria-label="Open menu", because it has no visible text.
Extending the hit area with a pseudo-element
Sometimes the design leaves no room for larger padding, for example a small "close" mark on a card. You can grow the clickable region invisibly using a pseudo-element:
.close {
position: relative;
}
.close::after {
content: "";
position: absolute;
inset: -10px;
}The ::after box is part of the element for hit testing, so taps inside it count. Negative inset values push the box 10 pixels outward on all sides. Check that this enlarged area does not overlap a neighbour, or you trade one problem for another.
Spacing between targets
Size is only half of the rule. Two 44-pixel buttons that touch each other still cause wrong taps, because the finger lands on the boundary.
Leave a gap of at least 8 pixels between adjacent targets, and more for destructive actions. WCAG 2.2 allows targets smaller than 24 pixels only if a 24-pixel circle centred on each one does not intersect another target. Spacing can substitute for size at the minimum level, but not at the comfortable one.
Use gap on a flex or grid container so spacing comes from one place:
.actions {
display: flex;
flex-wrap: wrap;
gap: 0.75rem;
}
.actions .button {
min-block-size: 44px;
padding-inline: 1.25rem;
}gap has two advantages over margins. It only applies between items, so there is no stray space at the ends. And with flex-wrap, it also spaces the rows when the buttons wrap onto a second line, which is common at narrow widths.
Separate dangerous actions
Place destructive controls away from frequent ones. A "Delete account" button directly beside "Save" is a design defect at any target size. Increase the gap, change the visual weight, or ask for confirmation.
Thumb zones
On a large phone held in one hand, the thumb reaches the bottom and middle of the screen easily. The top corners on the opposite side are hard to reach. This affects where you put frequent actions:
- Primary actions, such as "Add to basket" or "Continue", work well near the bottom edge.
- Rarely used or risky actions suit the harder-to-reach areas.
- Bottom-fixed bars are convenient but must not cover content or collide with the system gesture area. Use
padding-bottom: env(safe-area-inset-bottom)on devices with a home indicator.
Treat thumb zones as a guide, not a rule. Screen sizes, grips and left- or right-handedness vary, and a layout that depends on one hand posture fails others.
Forms and other controls
Form controls need the same care as links.
- Inputs should be at least 44 pixels tall. A 16-pixel font size on inputs also prevents iOS Safari from zooming in when the field gains focus.
- Associate each label with its input using
forandid. Tapping the label then focuses the field, which enlarges the effective target. - Checkboxes and radio buttons are tiny by default. Wrap the input and its text in one
<label>and give the label padding, so the whole row is tappable.
<label class="choice">
<input type="checkbox" name="newsletter">
Send me the monthly newsletter
</label>.choice {
display: flex;
align-items: center;
gap: 0.75rem;
min-block-size: 44px;
}
.choice input {
inline-size: 1.25rem;
block-size: 1.25rem;
}Hover is not available
Touch screens have no reliable hover state. Do not hide information or controls behind :hover. A tooltip that explains a button is invisible to a phone user, and a menu that opens on hover may open and close in the same tap.
If you want hover styling on devices that support it, scope it with a media query:
@media (hover: hover) and (pointer: fine) {
.card:hover {
box-shadow: 0 2px 8px rgb(0 0 0 / 0.2);
}
}The pointer feature reports the accuracy of the primary input: coarse for touch, fine for a mouse. You can also use @media (pointer: coarse) to enlarge targets only for touch. Be cautious, though: a laptop with a touch screen reports fine, and some users switch between inputs. Making targets large for everyone is the safer default.
Feedback and delay
A tap that gives no response feels broken. Provide a visible :active or :focus-visible style so the user sees that the control received the tap.
.button:active {
transform: scale(0.98);
}
.button:focus-visible {
outline: 3px solid currentColor;
outline-offset: 2px;
}Modern mobile browsers no longer wait 300 ms for a double-tap zoom when the page sets width=device-width in the viewport tag. You can also set touch-action: manipulation on controls to disable double-tap zoom on them specifically. Do not disable pinch zoom for the whole page with user-scalable=no. That blocks users who need to enlarge content.
A diagram of the decision
Common errors
- Sizing the text, not the box. Check the element's rendered height in developer tools, not its
font-size. - Using
height: 44pxon a link with long text. Fixed heights clip wrapped text. Usemin-block-size. - Putting links in a tight list with no spacing, such as a footer of 20-pixel-high links stacked directly on each other. Give list items padding or a gap.
- Enlarging a hit area with a pseudo-element until it overlaps the next control.
- Relying on hover for essential information.
- Testing only with a mouse, which hides all of the problems above.
Testing target size
Use developer tools first. In the Elements panel, select a control and read its box dimensions. Chrome's device toolbar emulates touch input, and Lighthouse includes an accessibility check for tap targets. Then test on a real phone with your thumb, one-handed, because emulation cannot reproduce how a finger feels on glass. Try tapping quickly through a form and a menu and note every mistap. Each one points to a target that is too small or too close to a neighbour.
Exercise
A page has a row of three icon buttons, each showing a 24 px icon with no padding, placed 2 px apart. Describe two changes that make them comfortable to tap, and write the CSS for the container and the buttons.
Show answer
Make each button at least 44 by 44 px by padding the button instead of enlarging the icon, and increase the spacing to at least 8 px. For example: .toolbar { display: flex; gap: 0.5rem; } .toolbar button { min-inline-size: 44px; min-block-size: 44px; display: inline-grid; place-items: center; padding: 0; } The icon stays 24 px, the tappable area becomes 44 px, and the 0.5rem gap (8 px) keeps taps from landing on a neighbour.
Exercise
Why is min-block-size: 44px usually better than height: 44px for a link?
Show answer
A fixed height can clip text when the label wraps onto a second line or the user enlarges their font size. A minimum lets the element grow while still guaranteeing the smallest comfortable target.