# Flexbox items will not wrap onto the next line on mobile

Source: https://coursesweb.net/forum/t/flexbox-items-will-not-wrap-onto-the-next-line-on-mobile/
Site: CoursesWeb Forum, category CSS Layout: Flexbox and Grid
Published: 2026-11-26. Updated: 2026-11-26. Replies: 1.

## Question by Gaelle R., 2026-11-26

Hello. I am building a row of product cards with flexbox. On desktop it is fine. On my phone (375px wide) the cards do not go to the next line. They stay in one row and the page scrolls sideways.

```css
.cards {
  display: flex;
  gap: 16px;
}
.card {
  flex: 0 0 260px;
  padding: 16px;
  background: #f4f4f4;
}
```

```html
<div class="cards">
  <div class="card">One</div>
  <div class="card">Two</div>
  <div class="card">Three</div>
</div>
```

I expected the third card to go below the others. In DevTools the .cards box is 375px wide, but each card is 260px, so they go outside of it. I tried width: 100% on .card, but then my desktop layout is broken. What am I missing? Thank you.

## Reply 1 by Ferdi K., 2026-11-26

Had the exact same thing on my first portfolio page. What fixed it for me (attempt number 4) was putting overflow-x: hidden on the body. The sideways scroll is gone and it looks fine on my phone now.

---
Cite as: CoursesWeb Forum, "Flexbox items will not wrap onto the next line on mobile", https://coursesweb.net/forum/t/flexbox-items-will-not-wrap-onto-the-next-line-on-mobile/, accessed 2026-11-26.
