---
name: css-flexboxgrid-layout-generator
description: "Turns a plain-language page layout (header, columns, sticky footer) into working HTML and CSS, choosing Grid, Flexbox, or Tailwind classes to match, responsive from the first line. Use when a described page layout such as header, sidebar, card columns, and sticky footer needs working HTML and CSS using Grid, Flexbox, or Tailwind. Do not use for fixing a layout that already exists, single-component alignment problems, or design mockups without code. Related topics: coding, css, design."
---

# CSS Flexbox/Grid Layout Generator

Turns a plain-language page layout (header, columns, sticky footer) into working HTML and CSS, choosing Grid, Flexbox, or Tailwind classes to match, responsive from the first line.

## When to use

Use this skill when a described page layout such as header, sidebar, card columns, and sticky footer needs working HTML and CSS using Grid, Flexbox, or Tailwind. Do not use it for fixing a layout that already exists, single-component alignment problems, or design mockups without code.

## Workflow

1. Ask the user for each input listed below in a single message, skipping any they have already given. Where options are listed, offer them, but accept other answers too.
2. Parse the description into regions and decide Grid for two-dimensional page structure and Flexbox for one-dimensional groups, stating the choice when the strategy is open.
3. Write semantic HTML for each region, with full boilerplate when requested.
4. Write mobile-first CSS or Tailwind classes that build the columns at wider widths and implement the sticky footer with a min-height wrapper.
5. Apply the gap and alignment options to their correct axis and comment the region rules.
6. Check that the markup renders a usable single column with the CSS removed, then add the two-sentence extension note.

## Inputs

- **Layout strategy** (choose one: CSS Grid, Flexbox, Tailwind CSS classes, Pick the best fit)
- **Describe the desired layout** (longer free text)
- **Responsive (mobile-friendly)** (choose one: Yes, No)
- **Gap or spacing between regions** (choose one: Small (8px), Medium (16px), Large (32px), Custom)
- **Alignment** (choose any: Center items vertically, Center items horizontally, Space evenly, Stretch to fill)
- **Include HTML boilerplate** (choose one: Yes, No)

## Output

Two fenced code blocks, HTML then CSS (or Tailwind-classed HTML alone), followed by two sentences on extending the layout with another region.

## Prompt template

Fill the inputs into this template and follow it as the full instruction.

### CSS Flexbox/Grid Layout Generator

Build the HTML and CSS for the page layout described below.

- Layout strategy: {{Layout strategy}}
- Describe the desired layout: {{Describe the desired layout}}
- Responsive (mobile-friendly): {{Responsive (mobile-friendly)}}
- Gap or spacing between regions: {{Gap or spacing between regions}}
- Alignment: {{Alignment}}
- Include HTML boilerplate: {{Include HTML boilerplate}}

Decide the structure first: regions that form a two-dimensional page (header, sidebar, main, footer) get Grid with named areas, one-dimensional rows and groups inside them get Flexbox, and when the user picks Tailwind translate the same decisions into utility classes. When the strategy is left to you, state the choice and the reason in one line. Write semantic elements for each region (header, nav, main, aside, footer) so the layout is readable without the CSS. When responsive is on, write mobile-first: single column by default, then media queries that introduce the columns, and make a sticky footer with min-height: 100vh on the wrapper rather than fixed positioning. Apply the alignment options to the axis they affect. Keep the CSS to what the layout needs and comment the region rules. Output the HTML (full boilerplate when requested, otherwise the body markup) and the CSS in separate fenced blocks, then two sentences on how to extend the layout with another region.

## Pitfalls

- Using Flexbox for a page grid with both rows and columns, which needs wrappers and width maths that Grid areas avoid.
- Making the footer sticky with position: fixed, which overlaps content on short pages instead of sitting at the bottom.
- Writing desktop-first CSS, so the mobile layout becomes an afterthought of overrides.
