Design Technologist · AI-Assisted CSS Engineering

Responsive Grid without breakpoint-driven column rules.

This showcase documents a self-organizing media gallery from raw semantic HTML through prompt engineering, human auditing, and a verified CSS Grid implementation that calculates its own columns.

01Problem
02CSS Concepts
03Raw HTML
04AI Prompt
05Audit
06Final Result
07Verification
01

Why breakpoint lists are a fragile way to define columns

A gallery should respond to the space it receives instead of depending on a developer predicting every useful viewport width.

Before

Traditional responsive grids often define two, three, or four columns through a chain of viewport breakpoints. A missed width can leave cards cramped, create awkward empty space, or force another maintenance rule into the stylesheet.

Modern approach

CSS Grid can compare the available inline size with each card’s minimum track size. The browser then creates as many tracks as fit, wraps the remaining cards, and distributes extra space without a column-specific media query.

Breakpoint chains Fixed columns Card margins auto-fill drift Floats
02

The CSS concepts behind an intrinsically responsive gallery

Six coordinated ideas allow the browser to form, wrap, size, and align the card collection without breakpoint-driven columns.

03

The semantic gallery before layout engineering

The content hierarchy is complete, but browser defaults still place every card in one uninterrupted block flow.

before.html
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Week 04 Lab: Media-Query-Free Grid</title>
</head>
<body>

  <div class="gallery-wrapper">
    <header class="gallery-header">
      <h1 class="gallery-title">Curated Discoveries</h1>
      <p class="gallery-subtitle">A self-organizing responsive media portal.</p>
    </header>

    <!-- The Auto-Scaling Grid Container -->
    <main class="grid-container">
      
      <!-- Card 1 -->
      <article class="media-card">
        <div class="media-card__visual">
          <img src="https://images.unsplash.com/photo-1451187580459-43490279c0fa?w=600" alt="Nebula space" class="media-card__img">
        </div>
        <div class="media-card__body">
          <span class="media-card__tag">Cosmos</span>
          <h2 class="media-card__heading">Deep Space Telemetry</h2>
          <p class="media-card__desc">Mapping the cosmic microwave background radiation across unexplored clusters.</p>
        </div>
      </article>

      <!-- Card 2 -->
      <article class="media-card">
        <div class="media-card__visual">
          <img src="https://images.unsplash.com/photo-1518770660439-4636190af475?w=600" alt="Microchip" class="media-card__img">
        </div>
        <div class="media-card__body">
          <span class="media-card__tag">Technology</span>
          <h2 class="media-card__heading">Silicon Architecture</h2>
          <p class="media-card__desc">How quantum computing layers are shifting the limits of traditional solid-state physics.</p>
        </div>
      </article>

      <!-- Card 3 -->
      <article class="media-card">
        <div class="media-card__visual">
          <img src="https://images.unsplash.com/photo-1464822759023-fed622ff2c3b?w=600" alt="Mountain peak" class="media-card__img">
        </div>
        <div class="media-card__body">
          <span class="media-card__tag">Nature</span>
          <h2 class="media-card__heading">High Alpine Ecology</h2>
          <p class="media-card__desc">Documenting biodiversity changes in sub-zero alpine meadows under global shifts.</p>
        </div>
      </article>

      <!-- Card 4 -->
      <article class="media-card">
        <div class="media-card__visual">
          <img src="https://images.unsplash.com/photo-1504384308090-c894fdcc538d?w=600" alt="Cyberpunk city" class="media-card__img">
        </div>
        <div class="media-card__body">
          <span class="media-card__tag">Urbanism</span>
          <h2 class="media-card__heading">The Decentralized City</h2>
          <p class="media-card__desc">Examining modern micro-infrastructure models in densely populated metropolitan areas.</p>
        </div>
      </article>

    </main>
  </div>

</body>
</html>

Browser defaults only

Curated Discoveries

A self-organizing responsive media portal.

Image: Nebula space

Deep Space Telemetry

Cosmos · Mapping cosmic background radiation.

Image: Microchip

Silicon Architecture

Technology · Exploring quantum computing layers.

Image: Mountain peak

High Alpine Ecology

Nature · Documenting alpine biodiversity changes.

Image: Cyberpunk city

The Decentralized City

Urbanism · Examining metropolitan micro-infrastructure.

04

How the AI prompt became an auditable grid contract

The drafting request converts the assignment into explicit structural, mathematical, responsive, and output-boundary requirements.

Layer 1 — Lock the structure

Keep the supplied semantic gallery elements and class names intact.

Layer 2 — Establish foundations

Apply predictable box sizing, fluid spacing, and relative typography units.

Layer 3 — Require the formula

Assign the exact auto-fit and minmax track declaration to the grid parent.

Layer 4 — Separate responsibilities

Use Grid for card tracks, Flexbox inside cards, and parent gap for gutters.

Layer 5 — Forbid legacy layout

Reject media-query columns, floats, fixed track counts, and child margins.

Layer 6 — Demand verification

Require explainable wrapping behavior, overflow checks, comments, and CSS-only output.

AI prompt
Act as a senior CSS systems engineer. Generate a production-ready stylesheet for the supplied semantic media-gallery HTML without replacing its structural class system.

Implementation requirements:

1. Apply a global reset that removes default margins and padding and uses box-sizing: border-box for predictable sizing.

2. Create a fluid visual theme with relative typography and spacing units such as rem, em, percentages, and clamp() where appropriate.

3. Set .grid-container to display: grid and declare grid-template-columns exactly as repeat(auto-fit, minmax(300px, 1fr)).

4. Use gap on .grid-container as the only owner of spacing between media cards. Do not place layout margins on individual cards.

5. Build each .media-card as a vertical Flexbox component so its visual region sits above its text body and every card stretches to the full height of its grid track.

6. Make images fill their visual region without distortion by using a controlled aspect ratio and object-fit: cover.

7. Do not use @media rules, floats, fixed column counts, or breakpoint-based column sizing anywhere in the returned stylesheet.

8. Include visible focus treatment only for elements that are actually interactive, preserve readable contrast, and prevent the gallery from creating page-level overflow.

9. Add concise comments explaining how auto-fit collapses unused tracks, how minmax() protects the 300px minimum, and how 1fr distributes remaining space.

Return only the complete CSS stylesheet.
05

Auditing the generated grid instead of trusting the draft

The stylesheet is accepted only after its track formula, spacing ownership, card internals, and prohibited techniques are inspected directly.

audited CSS excerpt
*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: system-ui, sans-serif;
}

.gallery-wrapper {
  inline-size: min(100% - 2rem, 80rem);
  margin-inline: auto;
  padding-block: 3rem;
}

.grid-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.25rem;
}

.media-card {
  display: flex;
  flex-direction: column;
  block-size: 100%;
  overflow: hidden;
  border-radius: 1rem;
}

.media-card__visual {
  aspect-ratio: 16 / 10;
}

.media-card__img {
  inline-size: 100%;
  block-size: 100%;
  object-fit: cover;
}

.media-card__body {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 0.75rem;
  padding: 1.25rem;
}
human audit target
Human audit targets:

@media
float
margin on .media-card
grid-template-columns
repeat(auto-fit, minmax(300px, 1fr))

Expected findings:

- No @media syntax in the generated gallery stylesheet.
- No floats or fixed column counts.
- One exact required grid-template-columns declaration.
- Card separation owned by .grid-container gap.
- Flexbox used inside every .media-card.
Verified: exact formula

The grid declares repeat(auto-fit, minmax(300px, 1fr)) exactly as required.

Verified: no assignment media queries

The gallery-specific CSS contains no breakpoint rule for columns, card sizing, or layout changes.

Verified: auto-fit behavior

Empty tracks collapse, allowing existing cards to stretch instead of reserving unused columns.

Verified: parent gap

Card separation belongs to .grid-container, not to margins on each article.

Verified: Flexbox cards

Every card is a vertical flex container whose body can grow to match neighboring card heights.

Corrected: predictable images

A fixed aspect ratio and object-fit: cover prevent image distortion and layout jumps.

Verified: no floats

The draft uses native Grid and Flexbox responsibilities rather than legacy fallback positioning.

Verified: contained minimum

The required 300px track minimum is preserved and exceptional narrow overflow stays inside the demonstration surface.

06

The final self-organizing Curated Discoveries gallery

The browser decides how many cards fit on each row while every card keeps the same minimum track width and proportional share of free space.

Tracks form themselves

auto-fit creates only the columns that fit and collapses unused tracks.

Cards keep a floor

minmax(300px, 1fr) protects readability while still permitting proportional expansion.

One gutter owner

The parent gap keeps spacing consistent without margins leaking from individual cards.

07

Technical verification before deployment

The final gallery is accepted only after its computed tracks, wrapping behavior, source constraints, and portfolio integration are inspected.

  1. Inspect .grid-container and confirm its computed display value is grid.
  2. Open every CSS concept card by keyboard and pointer, and confirm it reaches the precisely matched MDN reference in a safe new tab.
  3. Confirm grid-template-columns is authored as repeat(auto-fit, minmax(300px, 1fr)).
  4. Resize continuously and verify the browser changes the number of columns without breakpoint-driven column rules.
  5. Confirm two cards on a wide row stretch into available space rather than leaving empty auto-fill tracks.
  6. Confirm card separation is controlled by the parent gap.
  7. Inspect every .media-card and confirm it is a vertical Flexbox container.
  8. Confirm card bodies stretch so cards in the same row share a consistent height.
  9. Confirm image regions retain their aspect ratio and crop through object-fit: cover.
  10. Search the assignment-specific CSS block for @media, float, and fixed column-count declarations; none should be present.
  11. Verify the locked portfolio chrome remains unchanged even though it retains its pre-existing accessibility and print media rules.
  12. Test desktop, tablet, mobile, and narrow mobile widths and confirm there is no page-level horizontal overflow.
  13. At widths narrower than the required 300px card floor, confirm any overflow is contained inside the live demonstration.
  14. Zoom to 200% and confirm the gallery text, images, and internal code panels remain usable.
  15. Navigate the shared portfolio controls by keyboard and verify visible focus.
  16. Switch the saved portfolio theme and confirm the cloned showcase chrome remains readable.
  17. Confirm no root-level responsive-grid-showcase.html compatibility file was created for this brand-new route.

AI drafted the CSS. Human auditing verified intrinsic grid behavior, source constraints, accessibility boundaries, and portfolio preservation.