Search topics
Fixed-height boxes that cut off enlarged text
A header with a fixed height and hidden overflow cannot grow when the text gets bigger, so part of the menu is cut off.
height: 80px The problem
People who enlarge text can't read, or see where they are on, the part of the page that is cut off
A stationery shop's header holds the logo, six links (Pens, Paper, Gift sets, Workshops, Journal, Contact) and the cart. At the default text size they sit on one row. Someone who reads with larger text sets the browser's font size to 200%. The links no longer fit on one row, so they wrap onto three. The header is still 80 pixels tall and centres its contents, so only the middle row shows: the rows above and below it are cut off. Pressing Tab still moves focus to those links, but the focused link can't be seen, and nothing on the screen says where it went.
The header has height: 80px, chosen to match the design, and overflow: hidden, added to crop a background pattern. Enlarged text needs more height, but the box can't grow, so everything past 80 pixels is cut off and there is no way to scroll to it. Success criterion 1.4.4 asks that text can be resized to 200% without losing content or function. Here both are lost: the links can't be read, and the ones that can still be reached by keyboard can't be seen.
Anyone who needs the text larger than the design assumed, and anyone who moves through the header by keyboard at that size. On a phone, the same header can clip at the default size too, because a narrow screen wraps the links as well.
2 of 10 groups affected
- No vision (not affected)
- Low vision (affected)
- Colour vision (not affected)
- No hearing (not affected)
- Hard of hearing (not affected)
- No speech (not affected)
- Motor (affected)
- Reach, strength (not affected)
- Cognitive (not affected)
- Seizures (not affected)
- Limited vision People who enlarge text rather than zoom the whole page, so the layout stays wide enough to read, and older readers who set a larger default font size once and leave it. Both lose the links that fall outside the 80 pixels.
- Limited manipulation Keyboard users at that text size Tab onto links that are off the visible edge of the header, so focus disappears with nothing on screen to show where it went.
Most scanners load the page once, at the default size, where everything fits. axe has no rule for text that is cut off; its only 1.4.4 rule, meta-viewport, checks that the viewport tag doesn't block zoom. A probe has to enlarge the text, then compare each box's height with the text inside it. AI fixes often go wrong in one of three ways, each of which keeps text out of reach:
- Deleting
overflow: hiddenalone: the fixed height stays in place, so the extra rows spill out over the content below and overlap it. overflow: auto: turns the header into a small scrolling box.text-overflow: ellipsis: hides even more of the text.
What the checkers report
- axe DevTools
- Users should be able to zoom and scale the text up to 500%
- Zooming and scaling must not be disabled
- Lighthouse
[user-scalable="no"]is used in the<meta name="viewport">element or the[maximum-scale]attribute is less than 5.
Try it
Enlarge the text to 200% and read the menu
Drag the Text size slider. Can you still read every link in the header?
Broken Can you fix this?
Autumn notebooks are in
Hand-bound, 120 pages, in four colours.
The fix
Let every box that holds text grow with it
<header class="site-header"> <a href="/" class="logo">Inkwell & Co</a> <nav aria-label="Main"> <ul class="site-nav"> <li> <a href="/collections/pens">Pens</a> </li> <li> <a href="/collections/paper">Paper</a> </li> <li> <a href="/collections/gift-sets">Gift sets</a> </li> <li> <a href="/pages/workshops">Workshops</a> </li> <li> <a href="/blogs/journal">Journal</a> </li> <li> <a href="/pages/contact">Contact</a> </li> </ul> </nav> <a href="/cart" class="cart">Cart (2)</a></header>What is wrong2 points
- At 200% links are cut off: they need two or three rows, but the header stays 80 pixels tall and hides the rest.
- Keyboard users lose sight of focus: the hidden links are still in the page and in the tab order, so focus moves onto text nobody can see.
Let the header grow
<header class="site-header"> <a href="/" class="logo">Inkwell & Co</a> <nav aria-label="Main"> <ul class="site-nav"> <li> <a href="/collections/pens">Pens</a> </li> <li> <a href="/collections/paper">Paper</a> </li> <li> <a href="/collections/gift-sets">Gift sets</a> </li> <li> <a href="/pages/workshops">Workshops</a> </li> <li> <a href="/blogs/journal">Journal</a> </li> <li> <a href="/pages/contact">Contact</a> </li> </ul> </nav> <a href="/cart" class="cart">Cart (2)</a></header>How it is fixed2 steps
- Change
heighttomin-height. The header keeps its 80 pixels at the default size and grows when the text needs more. - Remove
overflow: hidden. At 200% the links wrap onto more rows and the header grows to hold them, so every link is visible and every focused link can be seen.
This fixes the Before and passes 1.4.4. The HTML doesn't change. If the background pattern needs cropping, crop it on an element of its own (see Implementation decisions).
Both options keep every link readable and reachable at 200%, and both meet 1.4.4. Letting the header grow is two lines of CSS with nothing to maintain, so start there. Its cost shows on a sticky or fixed header: two or three rows of large text can take a third of a laptop screen and stay there while people scroll. Folding the links keeps the header short at any size, which suits a sticky header or a design that must stay on one row, but it adds a script and a menu that has to be kept working. If your theme already has a menu button for small screens, folding is mostly a matter of triggering it by fit rather than by screen width.
Find the other fixed heights. The header is rarely the only one. Look for height, max-height and line-height in pixels on anything that holds text: announcement bars, buttons, badges, card titles, tab rows. line-height: 80px, used to centre a link vertically, makes every wrapped row 80 pixels tall; centre with align-items and padding instead.
Units alone don't fix it. A height in rem or em (technique C28) grows with the text, but only in proportion. When zoom narrows the page, or a translation is longer, the links wrap onto more rows than the box was sized for, and the extra rows are cut off again. Relative units help only while the number of lines stays the same.
Clip decoration, not text. If something must be cropped, crop it on an element that holds no text: a pseudo-element or a wrapper for the background. overflow-x: clip crops sideways only and leaves vertical overflow visible; overflow-x: hidden does not, because it turns the other axis into a scroll box.
Offsets that assume the old height. A position: fixed header usually comes with body { padding-top: 80px }, and sometimes scroll-padding-top: 80px or a sub-menu at top: 80px. Once the header can grow, those hide content under it. Prefer position: sticky, which keeps its place in the flow, or set the offset from the header's measured height.
Folding and focus. If the links fold while one of them has focus, close the menu and move focus to the menu button, or the focus is lost. Close the menu on Escape and return focus to the button. A theme's existing small-screen drawer usually does this already.
Line clamps. A clamped excerpt whose full text is one click away is a design choice; a clamped price, label or menu item is lost content.
Don't block zoom. A viewport tag with user-scalable=no, or a maximum-scale below 2, stops people pinch-zooming on a phone, which fails 1.4.4 on its own. Use <meta name="viewport" content="width=device-width, initial-scale=1"> and nothing more.
Verify the fix
5 checks, no mouse.
Test with: Zoom, Keyboard
Record the OS, browser and assistive-technology versions, the build, the date, and the actual result of each step. Repeat after the shared header or theme settings change.
How screen readers handle aria-expanded
Limits
This is a starting pattern, not a guarantee for every application. Strictly, 1.4.4 can be met by full-page zoom alone, but many people enlarge text only, and a box that clips then also clips at zoom when the page is narrow. Paths and class names in the snippets are placeholders. Test every page template, not only the header.
This is a recreated teaching example, not a finding about a named client. The code is a starting pattern: test it in your own product. No completed assistive-technology test is claimed here.
References
EaseWeb service
Fixed it? Keep it from coming back.
I turn guides like this one into rules your coding agents follow and checks your CI runs. Then I retest by hand with a keyboard and screen readers, periodically.