CodexBloom - Programming Q&A Platform

CSS Flexbox not wrapping items correctly in Firefox but works fine in Chrome

👀 Views: 311 💬 Answers: 1 📅 Created: 2025-06-15
css flexbox firefox layout

I just started working with I've looked through the documentation and I'm still confused about I’m working with an scenario where my Flexbox layout is not wrapping items correctly in Firefox, while it behaves as expected in Chrome... I have a simple Flexbox container with a few child items that should wrap when the container’s width is reduced. Here’s the CSS I’m using: ```css .container { display: flex; flex-wrap: wrap; justify-content: space-between; width: 100%; } .item { flex: 0 1 30%; margin: 10px; background-color: lightblue; padding: 20px; box-sizing: border-box; } ``` And here’s the HTML structure: ```html <div class="container"> <div class="item">Item 1</div> <div class="item">Item 2</div> <div class="item">Item 3</div> <div class="item">Item 4</div> <div class="item">Item 5</div> </div> ``` When I resize the browser window, the items don’t wrap as intended in Firefox, but they do wrap properly in Chrome. I’ve also checked the Firefox version (it’s 94.0.2) and tried resetting my browser cache. I even added a `min-width` property to the `.item` class but it didn’t help. I’m not seeing any CSS errors in the console, but the behavior is quite frustrating. Any insights on what might be causing this discrepancy? This is part of a larger service I'm building. Any help would be greatly appreciated! I'm using Css latest in this project.