Guide
Responsive Grids With Foundation XY Grid
A task guide to implementing Foundation’s XY Grid for responsive layouts, covering prerequisites, minimal markup, verification, and recovery from flexbox conflicts.
Published by Tasadduq Burney
06 Aug 2026, 11:21 UTC
4 min106.9K views0

Problem: Your Foundation layout won’t reflow across breakpoints
When a Foundation‑based design collapses or overflows as the browser narrows, the culprit is often the legacy float grid still present in older projects. The useful takeaway: Foundation’s XY Grid replaces floats with a flexbox utility system, letting you build responsive layouts with fewer spacer classes and more predictable alignment.
Prerequisites
- Foundation CSS bundle installed (version 6.0 or later recommended for XY Grid support)
- A wrapper element with the
.grid-containerclass to scope the grid and prevent leakage into other layout systems - Familiarity with breakpoint suffixes:
.small-,.medium-,.large-, etc., which map columns to screen widths - A browser with developer tools for the verification steps described later
Procedure: Implementing XY Grid
- Include the Foundation CSS file in your project. If using a package manager, run
npm install foundation-sitesand import the grid component, or add the compiled CSS via a CDN. - Mark up a grid container in your HTML:
- Place cells inside a row. Use
.grid-xfor a horizontal layout or.grid-yfor a vertical stack. Apply breakpoint‑specific column classes to each.cellto control width at different screen sizes. The default system is 12 columns, so.small-6spans half the width on small screens,.medium-4spans one‑third on medium screens, and.large-3spans one‑quarter on large screens. - For auto‑sizing a cell to fill remaining space, add
.small-autoor.medium-autoto the cell’s class list. - Create gutters without empty spacer cells by using offset classes. For example,
.medium-offset-2on a cell shifts it right by two columns on medium screens. - Control row‑level alignment with
.align-center,.align-justify, or.align-spaced. For individual cells, use.align-self-middleto override the row alignment.
<div class="grid-container">
<div class="grid-x">
<div class="cell small-6 medium-4 large-3">…</div>
<div class="cell small-6 medium-4 large-3">…</div>
</div>
</div>
Expected Checks
- Resize the browser window across small, medium, and large breakpoints. Cells should reflow smoothly and maintain the column ratios defined by their classes.
- Open developer tools, select the
.grid-xelement, and confirm that the computeddisplay: flexstyle is applied. - In the Elements panel, verify that each
.cellhas a width computing to the intended fraction of the 12‑column grid (for example,.small-6should compute to50%on small screens). - Check the browser console for any missing stylesheet errors or initialization warnings that would prevent grid classes from applying.
Comparison: XY Grid vs. Legacy Float Grid
| Aspect | XY Grid (Flexbox) | Legacy Float Grid |
|---|---|---|
| Layout mode | display: flex on the row | float: left on cells |
| Column sizing | Breakpoint‑specific utility classes (.cell small-6) |
Fixed classes (.small-6 with explicit widths) |
| Vertical stacking | .grid-y on the row |
Requires clearfix and manual width calculations |
| Gutter control | .medium-offset-2 |
.row with margin gutters |
| Browser support | Requires flexbox support; degrades gracefully in older browsers | Wider historic browser compatibility |
Recovery & Limitations
- Float grid conflicts: Avoid mixing
.grid-x(XY Grid) with legacy.rowand.columnclasses on the same element. If a layout breaks, remove XY Grid classes and wrap content in the traditional.rowcontainer with.columncells. Foundation 6 retains the float grid for backward compatibility, so this rollback is straightforward. - Flexbox dependency: XY Grid requires browsers that support flexbox. Layouts may degrade on older mobile browsers without partial support. Test your target audience’s browser coverage before deploying to production.
- Class‑name variation: Breakpoint suffixes and utility classes can differ across Foundation 6 minor releases. Always validate the generated markup against the exact version installed in your project.
- Recovery step: If the grid breaks unexpectedly, comment out the XY Grid row markup and wrap content in the legacy
.rowcontainer with.columncells. Verify that the fallback layout restores before re‑introducing XY Grid classes in a separate section.
0 replies
A thoughtful contribution can make all the difference. Be the first to share one.