Hit Area
Grow the touch target of a small control to 44px on touch screens, with no change to the layout.
hit-area-yInstall
Add the utility's CSS with the CLI, your coding agent, or by hand. It has no JavaScript.
Usage
Put hit-area on each small control, and hit-area-row on a toolbar so neighbors do not overlap. The area grows only on a touch screen, so the layout never moves.
Variants
The target grows only on a touch screen. In a tight row or column, grow one axis, so two targets never overlap. Our Button has hit-area built in.
- Alone
hit-area44 × 44 around a small dot or icon.
- In a row
hit-area-yGrows the height only. Or
hit-area-rowon the parent. - In a column
hit-area-xGrows the width only. Or
hit-area-columnon the parent.
Rules
The target is a centered ::after. Keep these things true and it works anywhere.
Options
The classes and the variables of the utility. Set a variable with an arbitrary property, such as [--hit-area-min-height:3rem].
| Name | Kind | Default | Description |
|---|---|---|---|
hit-area | class | 44 × 44px | Grows the touch area on both axes. |
hit-area-y · hit-area-x | class | 44px | Grows one axis only, for a control in a tight row or column. |
hit-area-row · hit-area-column | class | — | On a parent: every hit-area inside grows one axis only. |
--hit-area-min-width · -height | variable | 2.75rem | The smallest size of the area. |
- Scroll Fade
scroll-fadeFade the edges of a scroll area, only where it can scroll.
- Materials
material-brushed-aluminumMetal, glass, stone, and cloth surfaces that catch the light.
- Pattern
pattern-hatchHatch, dots, grid, and checker for empty or reserved areas.
- Shape
shape-zigzagCut the edges or corners of any box: zigzag, scallop, notch.
- Glow
glowA soft halo in the element's own color, for bars and lines.
- Typeset
typesetOne class styles the plain HTML of an article or a page.