← All prompts

Fluid CSS System

Websites

Works in ChatGPT, Claude, Gemini and Cursor. Free to use.

Fluid CSS System

What it does

Writes a stylesheet for your site from your colors and fonts, with no framework needed. It uses CSS variables, Grid, Flexbox and clamp(), so text and spacing scale smoothly on any screen. It also adds a dark mode and checks your color contrast.

When to use it

  • You have plain HTML and want it to look good on any screen size
  • You want a dark mode that reuses the same color variables
  • You’d like text and spacing to adjust smoothly without lots of breakpoints

The prompt

Act as a CSS developer who writes clean, modern, framework-free styles. Rules: Use CSS custom properties for all colors, spacing, and fonts. Use clamp() for fluid font sizes and spacing so fewer breakpoints are needed. Layout with Grid and Flexbox. Implement dark mode with a [data-theme] or prefers-color-scheme approach using the same variables. Mobile-first. Keep specificity low. Don't invent performance numbers. Write maintainable CSS.

My colors (name + hex): [LIST, or "suggest an accessible set"]
My fonts (heading / body): [NAMES, or "system fonts"]
The vibe: [E.G. calm/technical, warm, high-contrast]
The HTML I'm styling: [PASTE SKELETON, or describe the sections]

Give me:
1. A :root block of custom properties: color, spacing scale, font sizes with clamp(), radii. These are the design tokens.
2. A dark-mode block that reuses those variables (no duplicated rules).
3. Base + layout styles applied to the semantic tags, using Grid for page structure and Flexbox for components.
4. One fluid type scale so headings and body scale between a min and max without a long list of media queries.
5. A contrast note: confirm my text/background pairs meet WCAG AA, and flag any that don't with a fix.

Example

This is a made-up case, and we asked the AI to keep its answer short.

What we filled in:

My colors (name + hex): ink #1F2933, paper #F7F5F0, moss #3E6B48, clay #C2703E, mist #D9DEE3
My fonts (heading / body): Space Grotesk (from Google Fonts) for headings, system font stack for body
The vibe: calm/technical, with a bit of warmth from the clay accent. Not a startup look.
The HTML I'm styling: my portfolio and blog site (I am a front-end developer in Leipzig). Header with a text logo and a 4-link nav, main with an intro section (h1, one paragraph, two buttons), a grid of 6 project cards (image, h3, short text, tag list), a blog list (date, h3, excerpt), an about section with a portrait image beside two paragraphs, and a footer with 3 columns of links and a newsletter form. Semantic tags throughout. Text is in German and English, so long compound words in headings need to wrap without breaking the layout.

What came back:

1. Design tokens
@import url("https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@500;700&display=swap");
:root {
  --ink: #1F2933; --paper: #F7F5F0; --moss: #3E6B48; --clay: #C2703E; --mist: #D9DEE3; --clay-light: #CD8B62;
  --font-heading: "Space Grotesk", system-ui, sans-serif;
  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --step--1: clamp(0.83rem, 0.81rem + 0.11vw, 0.9rem);
  --step-0: clamp(1rem, 0.96rem + 0.21vw, 1.13rem);
  --step-1: clamp(1.2rem, 1.13rem + 0.34vw, 1.41rem);
  --step-2: clamp(1.44rem, 1.33rem + 0.53vw, 1.76rem);
  --step-3: clamp(1.73rem, 1.57rem + 0.78vw, 2.2rem);
  --step-4: clamp(2.07rem, 1.85rem + 1.12vw, 2.75rem);
  --space-xs: clamp(0.5rem, 0.42rem + 0.42vw, 0.75rem);
  --space-s: clamp(0.75rem, 0.63rem + 0.63vw, 1.13rem);
  --space-m: clamp(1rem, 0.83rem + 0.83vw, 1.5rem);
  --space-l: clamp(1.5rem, 1.25rem + 1.25vw, 2.25rem);
  --space-xl: clamp(2.5rem, 2rem + 2.5vw, 4rem);
  --radius-s: 0.25rem; --radius-m: 0.5rem; --radius-pill: 999px; --max-width: 72rem; --measure: 65ch;
}

2. Dark mode
:root {
  color-scheme: light dark;
  --bg: light-dark(var(--paper), var(--ink));
  --text: light-dark(var(--ink), var(--paper));
  --muted: light-dark(var(--moss), var(--mist));
  --link: light-dark(var(--moss), var(--clay-light));
  --on-link: light-dark(var(--paper), var(--ink));
  --line: light-dark(var(--mist), color-mix(in srgb, var(--mist) 25%, var(--ink)));
  --accent: var(--clay);
}
[data-theme="light"] { color-scheme: light; } [data-theme="dark"] { color-scheme: dark; }
Components read these role variables, so no rule is written twice. Tags keep mist and ink in both modes on purpose. The page follows the system setting until data-theme on the html element overrides it. light-dark() is recent CSS, so check it against the browsers you support.

3. Base and layout
This assumes the classes logo, intro, actions, button, button-quiet, projects, card, tags, posts and about, with the about heading and text inside one div.
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; min-height: 100dvh; display: grid; grid-template-rows: auto 1fr auto; background: var(--bg); color: var(--text); font-family: var(--font-body); font-size: var(--step-0); line-height: 1.6; }
img { display: block; max-width: 100%; height: auto; }
input, button { font: inherit; }
a { color: var(--link); text-underline-offset: 0.2em; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
body > header, main > section, body > footer { padding: var(--space-l) max(var(--space-m), (100% - var(--max-width)) / 2); }
main > section { padding-block: var(--space-xl); }
body > header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-s); }
:where(nav, .projects, .posts, footer) :where(ul, ol) { list-style: none; margin: 0; padding: 0; }
nav ul { display: flex; flex-wrap: wrap; gap: var(--space-xs) var(--space-m); }
.logo { font-family: var(--font-heading); font-size: var(--step-2); font-weight: 700; color: var(--text); text-decoration: none; }
.intro p, .about p { max-width: var(--measure); }
.actions { display: flex; flex-wrap: wrap; gap: var(--space-s); margin-top: var(--space-m); }
.button { padding: var(--space-xs) var(--space-m); border: 2px solid var(--link); border-radius: var(--radius-m); background: var(--link); color: var(--on-link); font-weight: 600; text-decoration: none; }
.button-quiet { background: transparent; color: var(--text); border-color: currentColor; }
.projects > ul { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 18rem), 1fr)); gap: var(--space-m); }
.card { display: flex; flex-direction: column; gap: var(--space-xs); padding: var(--space-s); border: 1px solid var(--line); border-top: 3px solid var(--accent); border-radius: var(--radius-m); }
.card img { aspect-ratio: 4 / 3; object-fit: cover; border-radius: var(--radius-s); }
.tags { display: flex; flex-wrap: wrap; gap: var(--space-xs); margin-top: auto; }
.tags li { padding: calc(var(--space-xs) / 4) var(--space-xs); border-radius: var(--radius-pill); background: var(--mist); color: var(--ink); font-size: var(--step--1); }
.posts li { padding-block: var(--space-s); border-bottom: 1px solid var(--line); }
time { color: var(--muted); font-size: var(--step--1); }
.about { display: grid; gap: var(--space-m); align-items: start; }
@media (min-width: 48em) { .about { grid-template-columns: minmax(12rem, 1fr) 2fr; } }
body > footer { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 12rem), 1fr)); gap: var(--space-m); border-top: 1px solid var(--line); }
footer form { display: flex; flex-wrap: wrap; gap: var(--space-xs); }
input { flex: 1 1 12rem; padding: var(--space-xs); border: 1px solid var(--muted); border-radius: var(--radius-s); background: var(--bg); color: var(--text); }

4. Fluid type scale
h1, h2, h3 { margin: 0 0 var(--space-xs); font-family: var(--font-heading); font-weight: 500; line-height: 1.15; overflow-wrap: break-word; hyphens: auto; text-wrap: balance; }
h1 { font-size: var(--step-4); } h2 { font-size: var(--step-3); } h3 { font-size: var(--step-1); }
Each step grows from a 1.2 ratio on a 16px base at 320px wide to a 1.25 ratio on an 18px base at 1280px, so the type needs no breakpoints. Body text uses step 0 and the logo uses step 2. hyphens: auto only works when the browser knows the language, so set lang="de" or lang="en" on the html element and on any post in the other language.

5. Contrast note
AA needs 4.5:1 for normal text, and 3:1 for large text (24px, or 18.7px bold) and for borders and focus rings that mark controls.
Passes:
ink on paper, 13.54:1, body text.
ink on mist, 10.9:1, the tags.
moss on paper, 5.67:1, links and dates in light mode. Paper text on the moss button is the same pair.
paper on ink, 13.54:1, and mist on ink, 10.9:1, dark mode text and dates.
clay focus ring, 3.39:1 on paper and 3.99:1 on ink.
Fails, with the fix already in the code:
clay text on paper, 3.39:1. Large text only, so clay stays an accent.
moss on ink, 2.39:1. Fails even for large text, so dark mode links and buttons use --clay-light (#CD8B62, your clay mixed 80/20 with paper). That gives 5.25:1 as text on ink and with ink text on it.
ink or paper text on plain clay, 3.99:1 and 3.39:1. Too low for button labels, so no button sits on clay.
mist on paper, 1.24:1. Fine for decorative lines, too faint for the input border, which uses --muted instead.

Tips

  • Give it your own hex codes, or type “suggest” and it will propose an accessible set.
  • As a follow-up, you can ask it to add print styles or reduced-motion handling.
  • Check the color contrast yourself with a contrast checker before the site goes live.