Architecture Note: Foundation XYZ Grid Responsive Layout
A concise guide to the requirements, minimal markup, trust boundaries, checks, failure modes, and change triggers for Foundation’s XYZ Grid system.
25 Oct 2025, 14:36 UTC

Requirements
Foundation’s XYZ Grid must provide a 12‑column flexible layout that adapts to three breakpoints (small, medium, large) without requiring custom CSS or JavaScript for basic column sizing. The system should:
- Allow developers to express column widths via breakpoint‑specific classes (e.g.,
small-6,medium-4,large-3). - Grow and shrink columns proportionally within a row while preserving the total of 12 columns at each breakpoint.
- Leave all data handling to the application; the grid itself does not interpret or sanitize content.
Minimal Suitable Design
The smallest markup that satisfies the requirements consists of three parts:
- A wrapper with the class
grid-xthat establishes the flex container. - One or more row elements, each using
grid-margin-x(horizontal gutter) orgrid-margin-y(vertical gutter) as needed. - Column divs inside a row, each assigned breakpoint classes that together sum to ≤ 12 for that breakpoint.
Example of a basic responsive page:
<div class="grid-x">
<div class="grid-margin-x">
<div class="small-12 medium-6 large-4">Column A</div>
<div class="small-12 medium-6 large-4">Column B</div>
<div class="small-12 medium-12 large-4">Column C</div>
</div>
</div>
No JavaScript is required for the layout to respond; the flex‑based classes compute widths directly in the browser.
Trust and Data Boundaries
The XYZ Grid operates entirely on the client side. It does not:
- Read or modify server‑side data.
- Perform any input validation or sanitization.
- Make network requests.
- Viewport resize test: Open the page in a browser and gradually narrow/widen the window. Observe that columns reflow at the small (
<640px), medium (640px‑1024px), and large (>1024px) breakpoints as defined by their classes. - DevTools flex‑basis inspection: Select a column, open the Computed tab, and check
flex-basis. For example, a column withmedium-6should show a value of 50 % of the row’s width. - Overflow test: Intentionally exceed the 12‑column limit at a breakpoint (e.g.,
medium-8+medium-5) and confirm that the row either wraps to a new line or produces a horizontal scroll bar, depending on the gutter settings. - The sum of column classes for a given breakpoint exceeds 12, causing unwanted wrapping or horizontal overflow.
- Custom CSS rules (e.g., explicit
width,flex, ormax-width) are applied to the same element that carries grid classes, overriding Foundation’s flex calculations and leading to misaligned columns. - JavaScript manipulates the DOM after page load in a way that removes or alters the grid classes, breaking the responsive behavior.
- A project requires a true two‑dimensional grid (both rows and columns defined) rather than a single‑dimensional flex layout; CSS Grid would then be more appropriate.
- Server‑side rendering of the grid markup is needed for SEO or initial‑paint performance, and the target environment strips or modifies client‑only classes before hydration.
- Legacy browser support (e.g., Internet Explorer 11) must be added, which Foundation 6.x no longer provides; a fallback or polyfill would be necessary.
Consequently, the only trust boundary is the content placed inside grid cells. If untrusted user‑generated content is injected without escaping, it can lead to cross‑site scripting (XSS) because the grid itself does not sanitize HTML. The mitigation is to escape or sanitize such content before it reaches the DOM, using the same practices you would apply to any other UI component.
Operational Checks
To verify that the grid behaves as intended, perform the following steps in a development environment:
These checks do not require any special permissions; they can be done by any developer with access to the page in a browser.
Failure Modes
The grid will not behave as expected when:
Each of these scenarios can be detected by the operational checks above: unexpected wrapping indicates a column‑sum overflow; misaligned widths in DevTools point to conflicting CSS; missing classes after a script run reveal DOM mutation issues.
Conditions That Would Change the Design
Consider revisiting the XYZ Grid approach if any of the following become true:
When any of these conditions arise, the minimal design would shift from the pure flex‑based XYZ Grid to either a CSS‑Grid implementation, a server‑side templating strategy, or a polyfilled flexbox solution, respectively.
0 replies
A thoughtful contribution can make all the difference. Be the first to share one.