How do I fix buttons overflowing on mobile?
Last checked 31 Aug 2026
Short answer
Set buttons to full width or allow text wrapping below a breakpoint, and shorten long button labels for mobile — ask Lovable to make buttons responsive rather than fixed-width.
Why buttons overflow
Buttons overflow their container or the screen edge on mobile when they have a fixed width, when the label is long and can't wrap, or when several buttons are forced into one row with no wrap allowed.
Common fixes
- Make buttons
w-fullon mobile and a fixed or auto width on desktop:w-full sm:w-auto. - Allow button groups to wrap instead of forcing a single row: use
flex flex-wrapor stack them vertically on mobile (flex-col sm:flex-row). - Shorten button text for small screens — "Get started" instead of "Get started with your free trial today".
- Ensure padding scales down slightly on mobile so a button with a long label doesn't push past the viewport edge.
Prompt example
On mobile, make all call-to-action buttons full width and stack multiple buttons vertically with 12px gaps between them. Keep the desktop layout as horizontal buttons.
Tap target size
Beyond overflow, make sure buttons are big enough to tap accurately — aim for at least 44px height. A button that fits the screen but is too small to tap reliably is still a mobile usability problem, just a different one.
What usually goes wrong
- Fixing the hero button but missing the same pattern repeated in a pricing table, footer, or card component — check every instance of that button style.
- Making buttons full-width on mobile without adjusting nearby spacing, so they end up touching adjacent elements — recheck padding after the width change.
- Long labels still overflowing even at full width — shorten the copy for mobile rather than relying on layout alone to fix a content problem.
Sources
Was this answer helpful?
Related questions
- AnswerHow do I make my Lovable website look less AI-generated?Set a real colour palette, a font pairing and spacing scale up front, then ask Lovable to remove generic gradients, stock-photo hero clichés and default shadcn styling so the site reads as bespoke.
- AnswerHow do I add animations?Ask for specific, subtle animations (fade-in on scroll, hover states, a smooth page transition) rather than "add animations" generally — Lovable can use Tailwind transitions or a library like Framer Motion depending on what you need.
- AnswerHow do I improve accessibility?Ask Lovable to check colour contrast, add alt text to images, ensure keyboard navigation works, and use semantic HTML/ARIA labels — these cover most common accessibility gaps in generated sites without needing a full audit tool.
- AnswerHow do I make a sticky header?Ask Lovable to make the header `fixed` or `sticky` at the top with a defined z-index, and add top padding to the page content equal to the header's height so it isn't hidden underneath.