Question

v0 component looks right but breaks on mobile Safari

Solved · 8 views · asked by rosa_m · edited

A card grid from v0 looks perfect in Chrome desktop. On my iPhone the cards overflow the screen horizontally and the page scrolls sideways.

What I’ve tried

Added overflow-x-hidden to the body like v0 suggested. It hides the scrollbar but the cards are still cut off.

Comment

1 answer

Marked as helpful by the asker
dev_ana · edited

overflow-x-hidden treats the symptom. The cause is almost always a grid child with min-width: auto, so long content (a URL, a code string) forces the column wider than the screen.

Add min-w-0 to the grid children and let long text break:

<div className="grid grid-cols-1 sm:grid-cols-2 gap-4">
  <div className="min-w-0 break-words">…</div>
</div>

Remove the body overflow hack afterwards, it also breaks sticky headers on iOS.

Comment