Short answer: yes, an AI assistant such as ChatGPT, Claude or Gemini can suggest a responsive layout, and it is quick at it. Give it your content and constraints, ask for mobile-first CSS that adapts on its own, and you will have a working draft in a minute or two.
The catch is that the AI writes code without looking at the result. Unless you show it a screenshot, it has never seen your page at 375 pixels wide. So the job has two halves: ask well, then test what comes back. This guide covers both.
What AI is good at, and where it guesses
It helps to know which parts of the answer you can lean on.
| Task | How far to trust it |
|---|---|
| Turning a content list into a page structure (what stacks, what sits side by side) | Good. Review the order on mobile. |
| Writing CSS Grid and Flexbox for a described layout | Good. The syntax is usually right. |
| Offering two or three alternative layouts to compare | Good. This is where it saves the most time. |
| Choosing breakpoints | Weak. It tends to repeat device widths from older tutorials. |
| Knowing how long your real headlines, names and prices are | None, unless you paste them in. |
| Confirming the layout does not overflow or overlap | None. Only a browser can tell you. |
In other words, use it for structure and first-draft code, and keep the judgment and the testing for yourself.
What to give the AI before you ask
Most weak layout suggestions come from a thin prompt. "Make me a responsive pricing section" forces the AI to invent your content, and invented content is always tidy: three plans, short names, features that all fit on one line. Real content is not tidy. Give it these four things:
- The content, in priority order. List every element in the section and say what matters most on a phone. Include the longest real examples: the 60 character headline, the plan called "Enterprise Plus (Annual)", the 14 item navigation.
- The width range. State the narrowest and widest widths you support. A sensible default is 320 pixels (the width the WCAG reflow rule is written around) up to a content container of about 1200 to 1440 pixels.
- Your constraints. Paste the existing CSS custom properties, spacing scale and container width. Mention the framework, if any, and anything fixed on the page such as a sticky header or a sidebar.
- The output you want. Plain CSS or Tailwind classes, semantic HTML, mobile-first, and which techniques to prefer. The next two sections give you the wording.
A prompt you can copy and adapt
Replace the parts in square brackets. It works in any general-purpose AI assistant.
Suggest a responsive layout for [a services section] on [a plumber's website]. Content, most important first: 1. [Section heading, up to 60 characters] 2. [6 service cards: icon, title up to 30 characters, 2 line description, link] 3. [One call to action button] Requirements: - Works from 320px wide to a 1200px container, with no horizontal scrolling. - Mobile-first plain CSS with semantic HTML. No framework. - Prefer layouts that adapt without media queries: CSS Grid with auto-fit and minmax(), flex-wrap, and clamp() for spacing and type. - Use rem for sizes. No fixed pixel widths or heights on containers. - Use my tokens: [paste your custom properties here]. Give me 2 options. For each one: describe how it looks at 320px, 768px and 1200px, then the HTML and CSS, then list anything likely to break with longer content.
The last line matters most. Asking the AI to describe the layout at three widths makes it reason about each one before writing code, and asking what might break gets you a list of things to test.
Ask for layouts that adapt on their own
Left alone, AI tools often produce a desktop layout plus a stack of media queries at 480, 768 and 1024 pixels. That works on those exact widths and breaks in between. Modern CSS has patterns that respond to the space available, and naming them in your prompt changes the answer you get.
A card grid with no breakpoints. Each column is at least 18rem wide, and the grid fits as many as it can:
.cards {
display: grid;
gap: 1.5rem;
grid-template-columns: repeat(auto-fit, minmax(min(100%, 18rem), 1fr));
}
At a 16 pixel root, 18rem is 288 pixels. The min(100%, 18rem) part stops a card from overflowing when the container is narrower than that.
Fluid type and spacing. clamp() sets a minimum, a preferred value that grows with the viewport, and a maximum. This heading is 32 pixels at a 360 pixel viewport and 56 pixels at 1240 pixels and above:
h1 { font-size: clamp(2rem, 1.3864rem + 2.7273vw, 3.5rem); }
AI assistants are prone to arithmetic slips in these values, so generate them with a calculator instead of trusting the numbers in a chat reply.
Container queries. A media query asks how wide the screen is. A container query asks how wide the component's own box is, which is what a card in a sidebar actually cares about. They have worked in every major browser since 2023:
.card-wrap { container-type: inline-size; }
@container (min-width: 28rem) {
.card { display: grid; grid-template-columns: 8rem 1fr; }
}
If the AI hands you fixed pixel values and you want them in rem, convert the whole block in one pass.
Seven mistakes AI layouts make often
These are worth checking in every suggestion, whichever assistant wrote it.
| Mistake | What you see | Fix |
|---|---|---|
| Fixed pixel widths on containers | Sideways scrolling on phones | max-width with width: 100% |
width: 100vw on a section | A few pixels of sideways scroll on desktop, because 100vw includes the scrollbar | width: 100% |
| Fixed heights on cards or heroes | Text spills out when it wraps to more lines | min-height, or no height at all |
Grid or flex children without min-width: 0 | A long word, table or code block pushes the column wider than the screen | Add min-width: 0 to the child, and an overflow rule to the wide element |
Font sizes in vw only | Text that does not grow when the visitor zooms or raises their font size | clamp() with a rem part |
height: 100vh on a mobile hero | The bottom of the hero hides behind the browser toolbar | min-height: 100svh or 100dvh |
Hiding content with display: none on small screens | Phone visitors never see part of the page | Reorder or collapse it instead of removing it |
Two more to watch for are menus that only open on hover, which touch screens cannot trigger reliably, and images with no max-width: 100%.
Test the suggestion at real widths
Paste the code into your project or a scratch page and look at it. This takes about ten minutes and catches most of the table above.
- Start at 375 pixels. Look for a horizontal scrollbar, clipped text and buttons that touch the screen edge.
- Drop to 320 pixels. This is the narrowest width worth supporting, and it is where long words and wide tables give up.
- Drag slowly from 320 to 1600 pixels. Layouts break between breakpoints more often than on them. Watch for the moment a third card sits alone on a row or a heading wraps to four lines.
- Swap in your longest real content. The longest product name, a two line button label, a translated heading if the site has other languages.
- Zoom to 200 percent. Text should grow and nothing should overlap.
- Finish on one real phone. A resized frame shows the right viewport width, but touch behavior and the mobile browser toolbar only show up on a device.
Send the results back to the AI
The second prompt is where AI earns its place. A specific report gets a specific fix; "it looks broken on mobile" gets a rewrite of code that was fine. Say the width, the element, what happened and what you expected:
At 340px wide, the third service card title "Emergency Callouts (24 Hours)" wraps to three lines and pushes the link below the card. At 700px the grid shows 2 cards per row and leaves 2 alone on the last row. Keep the auto-fit grid. Suggest the smallest CSS change for each problem and explain why it happens.
If your assistant accepts images, attach a screenshot and state the width it was taken at. Ask for the smallest change, not a new version, so you can see exactly what was altered and test only that.
Tip: keep one prompt per section of the page. Asking for a whole homepage at once produces generic sections, and it is much harder to test and correct.
Used this way, AI shortens the slow part of layout work, which is getting from a blank file to something you can react to. The parts it cannot do, looking at the page and deciding whether it is right, take about ten minutes with the routine above.
Frequently asked questions
Can AI design a responsive layout for me?
It can propose one, and the proposal is often a good starting point. An AI assistant is quick at turning a list of content into a sensible structure and the CSS Grid or Flexbox code for it. It does not see your page in a browser unless you show it a screenshot, so it cannot confirm that the layout works. Treat what it gives you as a draft and test it at real widths.
What should I include in a prompt for a responsive layout?
Four things: the content in priority order with realistic lengths, the narrowest and widest widths you support, the constraints of your project (existing CSS, design tokens, framework, any fixed header or sidebar), and the output you want, such as mobile-first CSS Grid with no fixed pixel widths. The more real content you give, the less the AI has to guess.
Which breakpoints should I ask the AI to use?
Ask it to use as few as possible and to place them where the content breaks, not at device names. Patterns such as auto-fit grids, flex-wrap and clamp() adapt without any media query. Where you do need one, a rule like "switch to two columns when each column can be at least 20rem wide" ages better than a list of phone and tablet widths.
Why does an AI-generated layout scroll sideways on my phone?
The usual causes are an element with a fixed pixel width, width: 100vw on a page with a visible scrollbar, a long word or URL that cannot wrap, a table or code block with no overflow rule, or a grid or flex child that is missing min-width: 0. Load the page at 375 pixels wide, find the element that sticks out past the right edge and fix that one rule.
Can I give the AI a screenshot instead of describing the page?
Yes, with assistants that accept images. A screenshot of the broken width plus the relevant HTML and CSS is the fastest way to get a targeted fix. Say what width the screenshot was taken at, because the AI cannot reliably measure it from the image, and do not paste screenshots that show private customer data.