Button wider than screen on mobile problems usually happen when a button uses a fixed width, nowrap text, large padding, icons, flex rows, or a parent container that does not allow the button to shrink safely.
Mobile Button Overflow Fix
Why is my button wider than the screen on mobile?
A button wider than the screen on mobile can create horizontal scroll, cut off CTA text, push the page sideways, or make the layout feel broken. The button is usually not “randomly too big.” It is often being forced wide by a fixed width, white-space:nowrap, too much padding, an icon label combination, or a flex row that refuses to wrap.
- Mobile CTA
- Horizontal overflow
- nowrap text
- flex wrapping
What the bug looks like
A CTA button sticks out of the viewport, gets cut off, forces horizontal scrolling, or breaks a mobile hero section.
Why it happens
Desktop button assumptions are being reused on mobile: fixed width, nowrap text, oversized padding, or non-wrapping flex rows.
What usually fixes it
Use max-width:100%, fluid width, safe wrapping, smaller mobile padding, and responsive button groups.
The button has a fixed desktop width
A fixed-width button can look perfect on desktop and still be wider than the mobile screen. If the viewport is 320px wide and the button is 360px wide, overflow is guaranteed.
Broken code
Fixed width.cta-button {
width: 360px;
padding: 14px 24px;
}
Broken visual result
The button keeps a desktop width inside a narrow viewport.
Correct code
Fluid width cap.cta-button {
width: min(100%, 360px);
max-width: 100%;
padding: 14px 20px;
}
Fixed visual result
The button can shrink with the viewport instead of pushing past it.
width:min(100%, 360px) keeps the desktop cap while protecting mobile screens.white-space:nowrap forces long button text off-screen
white-space:nowrap is useful for short labels, but it becomes dangerous when the CTA text is long. On mobile, a long label may need to wrap or shorten.
Broken code
Text cannot wrap.cta-button {
white-space: nowrap;
padding-inline: 28px;
}
Broken visual result
The text stays on one line even when the screen cannot fit it.
Correct code
Safe text behavior.cta-button {
max-width: 100%;
white-space: normal;
text-align: center;
line-height: 1.25;
padding: 12px 18px;
}
Fixed visual result
The CTA can wrap cleanly without creating horizontal scroll.
The button group does not wrap on mobile
Sometimes one button is fine, but two buttons together create the overflow. A row with primary and secondary CTAs needs to wrap or stack on narrow screens.
Broken code
No wrapping.button-group {
display: flex;
gap: 12px;
flex-wrap: nowrap;
}
.button {
white-space: nowrap;
}
Broken visual result
The button group stays in one row even when it cannot fit.
Correct code
Responsive button group.button-group {
display: flex;
gap: 12px;
flex-wrap: wrap;
}
.button {
flex: 1 1 160px;
max-width: 100%;
}
@media (max-width: 480px) {
.button {
flex-basis: 100%;
}
}
Fixed visual result
The buttons can wrap or stack instead of forcing horizontal overflow.
Icon, gap, and padding make the button wider than expected
A button label may fit by itself, but once you add an icon, a large gap, and big padding, the total width can overflow on mobile. The fix is to let the button shrink and wrap safely.
Broken code
Icon adds width.cta-button {
display: inline-flex;
gap: 14px;
min-width: 310px;
padding-inline: 28px;
white-space: nowrap;
}
Broken visual result
The icon, gap, padding, and text combine into a mobile overflow bug.
Correct code
Shrink-safe icon button.cta-button {
display: inline-flex;
align-items: center;
justify-content: center;
gap: 10px;
max-width: 100%;
min-width: 0;
white-space: normal;
padding: 12px 18px;
}
.cta-button svg {
flex: 0 0 auto;
}
Fixed visual result
The icon stays stable, and the text can wrap inside the safe width.
A production-minded mobile button pattern
A reliable mobile button pattern protects the viewport, supports long text, handles icons, and lets button groups wrap without creating horizontal scroll.
Premium code
Responsive CTA system.button-group {
display: flex;
flex-wrap: wrap;
gap: 12px;
}
.cta-button {
display: inline-flex;
align-items: center;
justify-content: center;
gap: .6rem;
width: min(100%, 320px);
max-width: 100%;
min-height: 48px;
padding: 12px 20px;
border-radius: 999px;
text-align: center;
line-height: 1.25;
white-space: normal;
}
.cta-button svg {
flex: 0 0 auto;
}
@media (max-width: 480px) {
.button-group {
flex-direction: column;
align-items: stretch;
}
.cta-button {
width: 100%;
padding-inline: 16px;
}
}
Premium visual result
The button system handles long labels, icons, and small screens without creating horizontal scroll.
Fast practical rule
If a button is wider than screen on mobile, first remove fixed width and white-space:nowrap. Then add max-width:100%, reduce mobile padding, and let button groups wrap or stack.
Debug checklist
- Inspect the button width in DevTools and look for fixed values like
width:360px. - Add
max-width:100%to protect the viewport. - Check whether
white-space:nowrapis forcing long text onto one line. - Reduce large mobile padding, especially
padding-inline. - Check icons, gaps, and
min-widthvalues inside the button. - Make button groups wrap with
flex-wrap:wrapor stack under a mobile breakpoint. - Inspect the parent container; the button may be revealing a larger overflow bug.
- Test real CTA text, not only short placeholder labels like “Click.”
max-width:100% and remove fixed desktop width.
Related fixes that can help
A mobile button overflow bug often connects to page overflow, text overflow, responsive layout, container width, and navbar CTA problems.
Final takeaway
A button wider than screen on mobile is usually caused by desktop button CSS being used in a narrow viewport. Fixed widths, nowrap text, large padding, icons, and non-wrapping flex rows can all push a CTA outside the screen.
Start by protecting the viewport with max-width:100%. Then make the text and button group responsive. A good mobile CTA can still look premium without forcing horizontal scroll.
Want more fixes like this?
Browse more mobile, overflow, and responsive CSS debugging guides in the FrontFixer library.