Skip to content
AI for Web Dev AI WorkflowCoding Assistants

How to Build a Responsive Website Using AI — Step by Step

Learn to build a responsive one-page website with AI, step by step. Plan a wireframe, write semantic HTML, create mobile-first CSS, add accessible JavaScript navigation, and test the result.

Build Responsive Websites with AI

Introduction

AI can help you create a website faster, but asking it to “build a responsive website” is not enough. A useful result needs a clear structure, real content, responsive rules, accessible navigation, and careful testing. Without those requirements, an AI assistant may produce a page that looks good at one screen size but breaks somewhere else.

In this tutorial, we will build a complete, mobile-friendly landing page by working with an AI coding assistant one development stage at a time. We will start with a project brief, plan the page, generate semantic HTML, create a mobile-first CSS layout, add a small JavaScript interaction, and test the result on narrow and wide screens.

Our example is Northline Studio, a fictional creative studio. By the end, you will have a working one-page website that runs locally in a browser, plus a repeatable method for using AI on future web projects.

Important: AI is the development assistant in this tutorial. The finished website is an ordinary HTML/CSS/JavaScript website; it does not send user data to an AI service and does not require an AI API key. The brand, concept projects, and email address in the demo are placeholders, not a real business or functioning contact service.

What You Will Learn

By the end of this tutorial, you will know how to:

  • Turn a vague website idea into a clear, testable project brief.
  • Ask AI for a sitemap and section-level wireframe before requesting code.
  • Use AI to create semantic HTML with meaningful headings and navigation.
  • Build a mobile-first design using CSS Grid, Flexbox, fluid typography, and media queries.
  • Add an accessible mobile navigation menu with vanilla JavaScript.
  • Ask for focused fixes without allowing AI to rewrite unrelated code.
  • Test responsive layouts at multiple viewport widths and with keyboard navigation.
  • Check AI-generated code for accessibility, security, maintainability, and broken links.
  • Prepare a small static site for publication without assuming AI output is automatically production-ready.

What We Are Building

The Northline Studio landing page contains these sections:

  1. Header and navigation — a brand link, section links, and a mobile menu button.
  2. Hero — a clear headline, supporting text, two calls to action, and a decorative browser mockup.
  3. Services — three cards describing the studio’s fictional services.
  4. Selected concepts — two illustrative work cards built with CSS, not external photos.
  5. Approach — a three-step process for planning and building.
  6. Contact CTA — a short message and a placeholder email link.
  7. Footer — project attribution and a back-to-top link.

Responsive behavior

Screen widthExpected layoutNavigation
Below 640pxSingle-column content and cardsCollapsible menu when JavaScript is enabled
640–767pxTwo-column service and work cards where space permits; stacked heroCollapsible menu
768–1023pxTwo-column hero and approach; two-column cardsHorizontal navigation
1024px and aboveWide two-column hero and three service cardsHorizontal navigation

These are layout breakpoints, not assumptions about particular devices. The page must also work between the listed widths.

Technologies and project structure

We will use only three files:

northline-ai-website/
├── index.html
├── styles.css
└── script.js

No frameworks, JavaScript libraries, image downloads, hosting accounts, command-line build tools, or paid AI subscription are needed to run the example.

Before You Start

You will need:

  • An AI coding assistant: ChatGPT or another assistant that can write and explain code.
  • A code editor: VS Code or a similar editor.
  • A modern browser: Chrome, Edge, Firefox, or Safari.
  • A project folder: northline-ai-website.
  • Optional: Your browser’s responsive/device emulation tools for testing multiple widths.

Create the project folder and three empty files. Open index.html in your editor. Keep the AI conversation available, but do not blindly paste or run everything the assistant suggests.

Our workflow will be:

Brief → Wireframe → HTML → CSS → JavaScript → Review → Test → Refine

The prompts below are examples of requests you can send to an AI assistant. The reference code is a complete, consistent implementation you can compare against the assistant’s output. A different implementation can also be correct if it satisfies the same requirements.


Step 1: Define the Website Brief Before Asking for Code

A common mistake is to begin with an instruction like “Make me a modern website.” That leaves too many important decisions to chance: the page structure, audience, content, interactions, color palette, and responsive behavior.

Weak prompt

Create a beautiful responsive agency website.

Better prompt: Define the project

Act as a senior front-end developer helping a beginner.

Project:
Build a one-page responsive landing page for a fictional
creative studio named Northline Studio.

Audience:
Small business owners looking for website design and
front-end development services.

Sections, in order:
1. Header with logo text and navigation
2. Hero with headline, description, two CTA links, visual
3. Services with three cards
4. Selected work with two concept project cards
5. Three-step process section
6. Contact call to action
7. Footer

Technology:
- Semantic HTML5
- Plain CSS3 with a mobile-first approach
- Vanilla JavaScript for the mobile menu only
- Separate index.html, styles.css, and script.js
- No frameworks, icon libraries, CDN, external images,
  inline event handlers, or form backend

Visual direction:
Light neutral background, dark text, blue accents,
generous spacing, rounded cards, bold readable typography.
Use CSS to create decorative project imagery.

Quality requirements:
- Useful from 320px through desktop widths
- No horizontal page scrolling at 320px
- Logical headings and visible keyboard focus
- Functional navigation links and skip link
- Mobile menu must be keyboard accessible
- Contact email must clearly be a placeholder
- All content must be honest fictional demo content

First, summarize the plan and list any assumptions.
Do not generate code yet.

Why this prompt works

The prompt establishes the purpose of the website, the exact content scope, technology limits, and measurable quality expectations. By explicitly prohibiting external dependencies, it also makes the final example easier to reproduce.

Checkpoint: Before moving on, check that the assistant’s plan includes every requested section and does not silently introduce React, Bootstrap, a payment flow, a contact form backend, or stock images.


Step 2: Ask AI for a Section-Level Wireframe

You do not need a high-fidelity design to begin. A simple wireframe helps you decide what comes first, how sections relate, and what must change when screen width becomes narrow.

Prompt: Plan desktop and mobile structure

Use the approved Northline Studio brief.

Create a text-only wireframe for the page.
Show the section order from header to footer.

For each section, provide:
- its purpose
- main content
- the desktop layout
- the mobile layout
- the main call to action, if any

Keep the design realistic for three files:
index.html, styles.css, and script.js.
Do not generate code yet.

Example wireframe

DESKTOP (768px+)
┌─────────────────────────────────────────────┐
│ Brand             Services Work Approach CTA│
├─────────────────────────────────────────────┤
│ Hero headline / CTA   │ Decorative mockup  │
├─────────────────────────────────────────────┤
│                 Services                    │
│        Card 1      Card 2      Card 3       │
├─────────────────────────────────────────────┤
│                Selected work                │
│             Project 1  Project 2            │
├─────────────────────────────────────────────┤
│ Process intro        │ Three process steps  │
├─────────────────────────────────────────────┤
│ Contact message                  Email CTA  │
├─────────────────────────────────────────────┤
│ Footer                                      │
└─────────────────────────────────────────────┘

MOBILE (below 640px)
┌───────────────────┐
│ Brand        Menu │
├───────────────────┤
│ Hero headline     │
│ Description       │
│ CTA links         │
│ Visual mockup     │
├───────────────────┤
│ Service card 1    │
│ Service card 2    │
│ Service card 3    │
├───────────────────┤
│ Project 1         │
│ Project 2         │
├───────────────────┤
│ Process           │
├───────────────────┤
│ Contact / CTA     │
├───────────────────┤
│ Footer            │
└───────────────────┘

A wireframe is an agreement about structure, not a guarantee of visual quality. You will still need to check wrapping, spacing, contrast, and usable controls in a real browser.

Checkpoint: All content remains in the same logical reading order on desktop and mobile. On narrow screens, columns stack naturally rather than hiding important sections.


Step 3: Generate the Semantic HTML First

Build the structure before styling. This lets you inspect the page’s content and semantics without distractions. It also reduces the chance that AI will couple presentation and behavior directly to the markup.

Prompt: Generate index.html

Using the approved brief and wireframe, create index.html only.

Requirements:
1. Include doctype, lang="en", UTF-8, viewport,
   description, title, and references to styles.css
   and deferred script.js.
2. Use header, nav, main, section, article, and footer
   where semantically appropriate.
3. Give each main section a unique ID for anchor links.
4. Use one H1 and a clear H2/H3 heading hierarchy.
5. Add a "Skip to main content" link.
6. Add a mobile menu button with aria-controls and
   aria-expanded="false". Do not add inline JavaScript.
7. Create the hero mockup and project artwork from markup
   designed to be styled by CSS. Mark purely decorative
   content with aria-hidden="true".
8. Use real links to existing section IDs. For contact,
   use hello@northline.example as an obvious demo address.
9. Avoid fake client claims, fake testimonials, external
   images, placeholders with href="#", and extra sections.

Output the complete HTML file, then briefly explain
its semantic structure and navigation IDs.

Working reference: index.html

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="Northline Studio is a fictional creative studio website built for a responsive web design tutorial.">
    <title>Northline Studio | Thoughtful Digital Design</title>
    <link rel="stylesheet" href="styles.css">
    <script src="script.js" defer></script>
</head>
<body>
    <a class="skip-link" href="#main-content">Skip to main content</a>

    <header class="site-header">
        <div class="container header-inner">
            <a class="brand" href="#top" aria-label="Northline Studio, home">
                Northline<span>Studio</span><span class="brand-dot">.</span>
            </a>

            <button class="menu-toggle" type="button"
                    aria-controls="primary-nav" aria-expanded="false"
                    aria-label="Open navigation">
                <span aria-hidden="true">☰</span>
                <span>Menu</span>
            </button>

            <nav class="site-nav" id="primary-nav" aria-label="Primary navigation">
                <a href="#services">Services</a>
                <a href="#work">Work</a>
                <a href="#approach">Approach</a>
                <a class="nav-contact" href="#contact">Contact</a>
            </nav>
        </div>
    </header>

    <main id="main-content">
        <section class="hero" id="top" aria-labelledby="hero-title">
            <div class="container hero-grid">
                <div class="hero-copy">
                    <p class="eyebrow">Independent digital design studio</p>
                    <h1 id="hero-title">Design that makes your next move <em>matter.</em></h1>
                    <p class="hero-description">
                        We create clear, memorable digital experiences for growing ideas.
                        Explore this fictional studio website built with HTML, CSS, and JavaScript.
                    </p>
                    <div class="hero-actions">
                        <a class="button button-primary" href="#work">Explore our work</a>
                        <a class="button button-secondary" href="#services">What we do</a>
                    </div>
                    <p class="hero-footnote">A practical, AI-assisted responsive website demo.</p>
                </div>

                <div class="hero-visual" aria-hidden="true">
                    <div class="visual-window">
                        <div class="window-bar">
                            <span class="window-dots"><i></i><i></i><i></i></span>
                            <span>northline / creative space</span>
                        </div>
                        <div class="visual-content">
                            <span class="visual-tag">A fresh perspective</span>
                            <div class="visual-circle"></div>
                            <div class="visual-title">Make<br>ideas<br>visible.</div>
                            <div class="visual-bottom">
                                <span>Design systems</span>
                                <span>Digital experiences ↗</span>
                            </div>
                        </div>
                    </div>
                    <div class="floating-note">Creative thinking<br><strong>meets clean code.</strong></div>
                </div>
            </div>
        </section>

        <section class="section services-section" id="services" aria-labelledby="services-title">
            <div class="container">
                <div class="section-heading">
                    <div>
                        <p class="eyebrow">What we do</p>
                        <h2 id="services-title">Useful by design.</h2>
                    </div>
                    <p>Our work connects visual clarity with practical front-end development.</p>
                </div>
                <div class="services-grid">
                    <article class="service-card">
                        <span class="service-number" aria-hidden="true">01</span>
                        <h3>Website design</h3>
                        <p>Responsive layouts that help visitors understand what matters.</p>
                    </article>
                    <article class="service-card">
                        <span class="service-number" aria-hidden="true">02</span>
                        <h3>Front-end builds</h3>
                        <p>Semantic HTML, adaptable CSS, and focused JavaScript interactions.</p>
                    </article>
                    <article class="service-card">
                        <span class="service-number" aria-hidden="true">03</span>
                        <h3>Design systems</h3>
                        <p>Reusable styles and components that bring consistency to every page.</p>
                    </article>
                </div>
            </div>
        </section>

        <section class="section work-section" id="work" aria-labelledby="work-title">
            <div class="container">
                <div class="section-heading">
                    <div>
                        <p class="eyebrow">Selected concepts</p>
                        <h2 id="work-title">Small ideas. Big possibilities.</h2>
                    </div>
                    <p>Two fictional concept projects created to demonstrate a flexible card layout.</p>
                </div>
                <div class="work-grid">
                    <article class="work-card">
                        <div class="work-art work-art-one" aria-hidden="true">
                            <span class="art-label">FIELDNOTES</span>
                            <span class="art-shape art-shape-one"></span>
                        </div>
                        <div class="work-meta">
                            <h3>Fieldnotes Journal</h3>
                            <p>Editorial concept · Web design</p>
                        </div>
                    </article>
                    <article class="work-card">
                        <div class="work-art work-art-two" aria-hidden="true">
                            <span class="art-label">FORM & FUNCTION</span>
                            <span class="art-shape art-shape-two"></span>
                        </div>
                        <div class="work-meta">
                            <h3>Form & Function</h3>
                            <p>Brand concept · Front-end</p>
                        </div>
                    </article>
                </div>
            </div>
        </section>

        <section class="section approach-section" id="approach" aria-labelledby="approach-title">
            <div class="container approach-grid">
                <div>
                    <p class="eyebrow">Our approach</p>
                    <h2 id="approach-title">Simple steps, stronger outcomes.</h2>
                    <p class="approach-intro">A useful process for real projects—and for working with an AI coding assistant.</p>
                </div>
                <ol class="process-list">
                    <li><strong>Discover</strong><span>Define goals, audience, content, and constraints.</span></li>
                    <li><strong>Design</strong><span>Plan the structure and the responsive experience.</span></li>
                    <li><strong>Build</strong><span>Develop, inspect, test, and improve the result.</span></li>
                </ol>
            </div>
        </section>

        <section class="section contact-section" id="contact" aria-labelledby="contact-title">
            <div class="container contact-inner">
                <div>
                    <p class="eyebrow">Get in touch</p>
                    <h2 id="contact-title">Have an idea worth building?</h2>
                    <p>Replace the demo email address with your own before publishing a real website.</p>
                </div>
                <a class="button button-light" href="mailto:hello@northline.example?subject=Project%20inquiry">Start a conversation</a>
            </div>
        </section>
    </main>

    <footer class="site-footer">
        <div class="container footer-inner">
            <span>Northline Studio — fictional tutorial project.</span>
            <a href="#top">Back to top ↑</a>
        </div>
    </footer>
</body>
</html>

Understand the generated HTML

The important decisions are structural:

  • <header> contains branding and navigation, while <main> contains the primary content.
  • <section> elements use aria-labelledby to associate them with their visible headings.
  • The three services and two portfolio concepts use <article> because each card has a distinct subject.
  • The navigation links point to actual IDs such as #services, #work, and #contact.
  • The skip link gives keyboard users a direct way to bypass navigation.
  • The mobile menu is a real <button>, not a clickable <div> or a fake hyperlink.
  • The decorative hero mockup and card artwork are hidden from assistive technology with aria-hidden="true".

The page also uses an intentionally non-working example email address ending in .example. Replace it with a real contact address before publishing a real business website.

Verify the HTML before moving on

  1. Save index.html and open it in your browser.
  2. Expect unstyled content. That is normal: we have not written CSS yet.
  3. Check that headings and sections appear in the correct order.
  4. Click the anchor links and confirm they target the right sections.
  5. Verify that each ID is unique and that the document has one H1.

Checkpoint: The HTML content is understandable even without its final design. Do not proceed if the structure or copy is missing.


Step 4: Use AI to Build Mobile-First Responsive CSS

Instead of designing for a 1440px monitor and trying to squeeze everything into a phone, we will begin with single-column layouts and add columns when the viewport has sufficient space.

Our CSS uses:

  • Custom properties for reusable colors, borders, and spacing-related values.
  • Fluid typography with clamp() so headings adapt across widths.
  • Flexbox for navigation, buttons, and smaller alignment patterns.
  • CSS Grid for page sections and card layouts.
  • Media queries at 640px, 768px, and 1024px to enhance the layout progressively.
  • Visible focus styles and reduced-motion support.

Prompt: Generate styles.css

Write only styles.css for the existing index.html.
Do not modify the HTML or create JavaScript yet.

Design requirements:
- Mobile-first layout, starting at 320px
- Light cream background, dark text, deep-blue accents
- System font stack; no external fonts
- Max content width around 1120px, with side gutters
- Clear section spacing and readable text widths
- Fluid hero heading with clamp()
- Hero and approach stacked on mobile, two columns
  at 768px and above
- Services: one column on small phones, two at 640px,
  three at 1024px
- Work cards: one column on small phones, two at 640px
- Keep decorative artwork within its card boundaries
- No horizontal overflow at 320px

Navigation:
- Horizontal links at 768px and above
- On mobile, show all links if JavaScript is disabled
- When the html element has class "js", hide mobile
  navigation until it gains class "is-open"
- Only show the menu button on mobile when the "js"
  class exists

Accessibility:
- Visible :focus-visible styles
- Show skip link when focused
- Respect prefers-reduced-motion
- Use readable color contrast

Use CSS Grid and Flexbox, not absolute positioning
for the main page layout. Output the complete file.

Working reference: styles.css

:root {
    color-scheme: light;
    --ink: #17202c;
    --muted: #566271;
    --cream: #f8f7f3;
    --white: #ffffff;
    --line: #dde2e6;
    --accent: #284caa;
    --accent-dark: #19357b;
    --radius: 1.25rem;
    --shadow: 0 18px 50px rgba(20, 38, 60, 0.12);
}

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

html {
    scroll-behavior: smooth;
    scroll-padding-top: 5rem;
}

body {
    margin: 0;
    background: var(--cream);
    color: var(--ink);
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    line-height: 1.6;
}

a {
    color: inherit;
}

button,
a {
    -webkit-tap-highlight-color: transparent;
}

button {
    font: inherit;
}

:focus-visible {
    outline: 3px solid var(--accent);
    outline-offset: 4px;
}

.container {
    width: min(calc(100% - 2rem), 70rem);
    margin-inline: auto;
}

.skip-link {
    position: absolute;
    z-index: 100;
    top: -5rem;
    left: 1rem;
    padding: 0.75rem 1rem;
    background: var(--white);
    color: var(--ink);
}

.skip-link:focus {
    top: 1rem;
}

.site-header {
    position: relative;
    z-index: 10;
    background: var(--white);
    border-bottom: 1px solid var(--line);
}

.header-inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    min-height: 5rem;
    gap: 0.75rem;
}

.brand {
    font-size: 1.18rem;
    font-weight: 850;
    letter-spacing: -0.05em;
    text-decoration: none;
}

.brand span:not(.brand-dot) {
    font-weight: 500;
}

.brand-dot {
    color: var(--accent);
}

.menu-toggle {
    display: none;
    gap: 0.5rem;
    align-items: center;
    padding: 0.55rem 0.75rem;
    color: var(--ink);
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: 0.55rem;
    cursor: pointer;
}

.site-nav {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.site-nav a {
    font-size: 0.94rem;
    font-weight: 650;
    text-decoration: none;
}

.site-nav a:hover,
.footer-inner a:hover {
    color: var(--accent);
}

.site-nav .nav-contact {
    padding: 0.55rem 0.95rem;
    color: var(--white);
    background: var(--ink);
    border-radius: 0.5rem;
}

.hero {
    padding: 4.5rem 0 5rem;
    overflow: hidden;
}

.hero-grid,
.approach-grid {
    display: grid;
    gap: 3rem;
}

.eyebrow {
    margin: 0 0 1rem;
    color: var(--accent);
    font-size: 0.77rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

h1,
h2,
h3,
p {
    margin-top: 0;
}

h1,
h2,
h3 {
    line-height: 1.12;
    letter-spacing: -0.045em;
}

h1 {
    max-width: 12ch;
    margin-bottom: 1.25rem;
    font-size: clamp(2.5rem, 8vw, 4.9rem);
}

h1 em {
    color: var(--accent);
    font-style: normal;
}

.hero-description,
.approach-intro {
    max-width: 35rem;
    color: var(--muted);
    font-size: 1.05rem;
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 2rem;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 3rem;
    padding: 0.7rem 1.1rem;
    border-radius: 0.65rem;
    font-weight: 750;
    text-align: center;
    text-decoration: none;
}

.button-primary {
    color: var(--white);
    background: var(--accent);
}

.button-primary:hover {
    background: var(--accent-dark);
}

.button-secondary {
    background: var(--white);
    border: 1px solid #c8ced7;
}

.button-secondary:hover {
    border-color: var(--accent);
}

.hero-footnote {
    margin: 1.5rem 0 0;
    color: var(--muted);
    font-size: 0.85rem;
}

.hero-visual {
    position: relative;
    min-width: 0;
}

.visual-window {
    overflow: hidden;
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.window-bar {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.85rem 1rem;
    color: var(--muted);
    font-size: 0.7rem;
}

.window-dots {
    display: flex;
    gap: 0.3rem;
}

.window-dots i {
    width: 0.55rem;
    height: 0.55rem;
    background: #d1d9e8;
    border-radius: 50%;
}

.visual-content {
    position: relative;
    display: flex;
    flex-direction: column;
    min-height: 18rem;
    padding: 1.5rem;
    overflow: hidden;
    color: var(--white);
    background: linear-gradient(135deg, #173574, #456dd1 68%, #93a7f0);
}

.visual-tag,
.visual-title,
.visual-bottom {
    position: relative;
    z-index: 1;
}

.visual-tag {
    font-size: 0.73rem;
    font-weight: 650;
}

.visual-title {
    margin-block: auto;
    font-size: clamp(2.4rem, 8vw, 4.3rem);
    font-weight: 850;
    line-height: 0.95;
    letter-spacing: -0.07em;
}

.visual-circle {
    position: absolute;
    top: 20%;
    right: -14%;
    width: 16rem;
    aspect-ratio: 1;
    border: 2.8rem solid rgba(255, 255, 255, 0.15);
    border-radius: 50%;
}

.visual-bottom {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 0.4rem;
    margin-top: 2.5rem;
    font-size: 0.67rem;
}

.floating-note {
    position: relative;
    width: fit-content;
    max-width: 90%;
    margin: -1rem 0 0 auto;
    padding: 0.75rem 1rem;
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: 0.8rem;
    box-shadow: 0 10px 28px rgba(20, 38, 60, 0.1);
    font-size: 0.8rem;
    line-height: 1.35;
}

.floating-note strong {
    color: var(--accent);
}

.section {
    padding: 4rem 0;
}

.section-heading {
    display: grid;
    gap: 0.5rem;
    margin-bottom: 2rem;
}

.section-heading h2,
.approach-section h2,
.contact-section h2 {
    max-width: 16ch;
    margin-bottom: 0;
    font-size: clamp(2rem, 5vw, 3.2rem);
}

.section-heading > p {
    max-width: 25rem;
    color: var(--muted);
}

.services-section {
    background: var(--white);
}

.services-grid,
.work-grid {
    display: grid;
    gap: 1rem;
}

.service-card {
    padding: 1.6rem;
    background: var(--cream);
    border: 1px solid var(--line);
    border-radius: var(--radius);
}

.service-number {
    display: inline-block;
    margin-bottom: 2.5rem;
    color: var(--accent);
    font-weight: 800;
}

.service-card h3 {
    margin-bottom: 0.75rem;
    font-size: 1.4rem;
}

.service-card p,
.work-meta p {
    margin-bottom: 0;
    color: var(--muted);
}

.work-art {
    position: relative;
    display: grid;
    min-height: 16rem;
    padding: 1.5rem;
    overflow: hidden;
    border-radius: var(--radius);
    isolation: isolate;
}

.work-art-one {
    color: #f8e9cd;
    background: #2e4b3a;
}

.work-art-two {
    color: #2b245d;
    background: #e6d6f9;
}

.art-label {
    position: relative;
    z-index: 1;
    align-self: start;
    font-size: clamp(1.2rem, 4vw, 2.5rem);
    font-weight: 850;
    letter-spacing: -0.06em;
}

.art-shape {
    position: absolute;
    right: -8%;
    bottom: -50%;
    width: 75%;
    aspect-ratio: 1;
    border-radius: 48% 52% 35% 65%;
    transform: rotate(-28deg);
}

.art-shape-one {
    background: #a9c884;
}

.art-shape-two {
    background: #7d69cd;
}

.work-meta {
    padding: 1rem 0 0.5rem;
}

.work-meta h3 {
    margin-bottom: 0.3rem;
    font-size: 1.25rem;
}

.approach-section {
    background: #e9eef9;
}

.approach-intro {
    margin-top: 1rem;
}

.process-list {
    display: grid;
    gap: 0;
    margin: 0;
    padding: 0;
    list-style: none;
    counter-reset: process;
}

.process-list li {
    display: grid;
    grid-template-columns: 2rem 1fr;
    column-gap: 0.7rem;
    padding: 1.2rem 0;
    border-bottom: 1px solid #c6d1e6;
    counter-increment: process;
}

.process-list li::before {
    grid-row: span 2;
    content: counter(process, decimal-leading-zero);
    color: var(--accent);
    font-size: 0.75rem;
    font-weight: 800;
}

.process-list li strong {
    font-size: 1.2rem;
}

.process-list li span {
    color: var(--muted);
}

.contact-section {
    color: var(--white);
    background: var(--ink);
}

.contact-section .eyebrow {
    color: #9bb7ff;
}

.contact-section p:not(.eyebrow) {
    max-width: 32rem;
    margin-top: 1rem;
    color: #d7e0ed;
}

.contact-inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1.75rem;
}

.button-light {
    color: var(--ink);
    background: var(--white);
}

.button-light:hover {
    background: #e9eef9;
}

.site-footer {
    padding: 1.5rem 0;
    background: var(--white);
}

.footer-inner {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 0.75rem;
    color: var(--muted);
    font-size: 0.87rem;
}

.footer-inner a {
    font-weight: 650;
    text-decoration: none;
}

@media (max-width: 767px) {
    .js .menu-toggle {
        display: inline-flex;
    }

    .site-nav {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        width: 100%;
        gap: 0;
        padding: 0.5rem 0 1rem;
        border-top: 1px solid var(--line);
    }

    .js .site-nav {
        display: none;
    }

    .js .site-nav.is-open {
        display: flex;
    }

    .site-nav a {
        padding: 0.65rem 0.4rem;
    }

    .site-nav .nav-contact {
        padding: 0.65rem;
        text-align: center;
    }
}

@media (min-width: 640px) {
    .container {
        width: min(calc(100% - 3rem), 70rem);
    }

    .services-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .work-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (min-width: 768px) {
    .hero {
        padding: 6rem 0;
    }

    .hero-grid {
        grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
        align-items: center;
        gap: 3rem;
    }

    .visual-content {
        min-height: 23rem;
    }

    .section {
        padding: 5.5rem 0;
    }

    .section-heading {
        grid-template-columns: minmax(0, 1fr) minmax(0, 22rem);
        align-items: end;
        gap: 2rem;
    }

    .approach-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        align-items: start;
        gap: 5rem;
    }
}

@media (min-width: 1024px) {
    .services-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }
}

Why this CSS is responsive

The .container rule uses min(calc(100% - 2rem), 70rem), which provides side gutters on a narrow screen without allowing the content to grow indefinitely on a large monitor.

grid-template-columns: repeat(2, minmax(0, 1fr)) creates two equal, flexible columns. The minmax(0, 1fr) part helps prevent grid items from refusing to shrink because of their intrinsic minimum size.

The media queries add complexity only when there is space for it. The hero starts stacked and becomes two columns at 768px, while the service cards move to three columns at 1024px.

The decorative content uses gradients and CSS shapes, so the project does not depend on unavailable external images. The visual is illustrative, not evidence of previous client work.

Test the layout before adding JavaScript

At this stage, open index.html and resize the browser. The page should become wider and rearrange its grids without requiring JavaScript. On a small screen, the menu links will initially remain visible: the next step will add progressive enhancement for the collapsible menu.

Checkpoint: Inspect at 320px and at desktop width. If the layout scrolls horizontally, find the offending element before asking AI to change unrelated CSS.


Step 5: Add Accessible Mobile Navigation with JavaScript

A responsive layout does not always need JavaScript. Our hero, cards, spacing, and typography are already responsive with CSS alone. We will use JavaScript only for the mobile navigation interaction.

The behavior should be predictable:

  1. On small screens, the menu button opens and closes the navigation.
  2. The button’s aria-expanded attribute reflects the current state.
  3. Activating a navigation link closes the menu.
  4. Pressing Escape closes an open menu and returns focus to the button.
  5. Moving between mobile and desktop widths resets the menu state.
  6. If JavaScript is unavailable, the mobile links stay visible and accessible.

Prompt: Generate script.js

Write only script.js for the Northline Studio website.
Keep existing HTML IDs/classes and CSS behavior unchanged.

Use the existing selectors:
- .menu-toggle
- #primary-nav

Requirements:
- Use plain JavaScript with no external library.
- Add class "js" to the html element after selecting
  the navigation elements successfully.
- Toggle class "is-open" on #primary-nav.
- Keep aria-expanded and the button's accessible label
  synchronized with the open/closed state.
- Close the mobile menu after a navigation link click.
- Close an open menu on Escape and return keyboard
  focus to the menu button.
- Close/reset the menu when the viewport crosses 767px.
- Do not insert HTML strings, use inline handlers,
  or add unrelated animation libraries.

Give me the complete script.js and explain how to test it.

Working reference: script.js

const menuButton = document.querySelector(".menu-toggle");
const primaryNav = document.querySelector("#primary-nav");
const mobileQuery = window.matchMedia("(max-width: 767px)");

if (menuButton && primaryNav) {
    document.documentElement.classList.add("js");

    function setMenuOpen(isOpen) {
        menuButton.setAttribute("aria-expanded", String(isOpen));
        menuButton.setAttribute(
            "aria-label",
            isOpen ? "Close navigation" : "Open navigation"
        );
        primaryNav.classList.toggle("is-open", isOpen);
    }

    menuButton.addEventListener("click", () => {
        const isOpen = menuButton.getAttribute("aria-expanded") === "true";
        setMenuOpen(!isOpen);
    });

    primaryNav.addEventListener("click", (event) => {
        if (mobileQuery.matches && event.target.closest("a")) {
            setMenuOpen(false);
        }
    });

    document.addEventListener("keydown", (event) => {
        const isOpen = menuButton.getAttribute("aria-expanded") === "true";

        if (event.key === "Escape" && mobileQuery.matches && isOpen) {
            setMenuOpen(false);
            menuButton.focus();
        }
    });

    mobileQuery.addEventListener("change", () => {
        setMenuOpen(false);
    });
}

Understand how the JavaScript works

The script first locates the button and navigation and creates a matchMedia() query for screens up to 767px wide. It adds the js class to the document only when the required navigation elements exist.

The setMenuOpen() function changes three things together: the button’s aria-expanded state, its accessible label, and the navigation’s .is-open class. Keeping these values synchronized prevents a mismatch between what the menu shows and what assistive technology announces.

event.target.closest("a") detects clicks on navigation links, and the keyboard handler listens for Escape. The media query’s change event resets state when the viewport crosses the mobile/desktop boundary.

Progressive enhancement: Without JavaScript, the .js class is never added, so the CSS displays the mobile links instead of hiding them behind a button that cannot work.

Test the menu

  1. Set your browser width to 375px.
  2. Confirm that the menu button is visible and the links are collapsed.
  3. Open the menu; verify the links appear.
  4. Select Services; verify that the page scrolls to the section and the menu closes.
  5. Open the menu again, then press Escape; verify the menu closes and focus returns to the button.
  6. Resize to 1024px; verify that the horizontal links appear and the menu button disappears.
  7. Disable JavaScript or open the page with scripting blocked; verify that the mobile links remain available.

Checkpoint: The menu works with a mouse and a keyboard, and there are no unexpected errors in the browser Console.


Step 6: Test the Website at Realistic Viewport Sizes

An AI assistant may say “fully responsive,” but that is a description, not proof. Open developer tools, switch to responsive mode, and test your actual files.

Responsive testing checklist

ViewportWhat to verify
320pxNo horizontal page scroll; no clipped text; readable header and buttons
375pxHero stacks; mobile menu works; cards occupy one column
640pxService and work grids become two columns; hero remains stacked
767pxMobile navigation still works at the upper boundary
768pxNavigation becomes horizontal; hero and approach use two columns
1024pxThree service cards fit on one row; work cards remain in two columns
1440pxContainer stays readable and does not stretch edge-to-edge

Make sure to test both the layout and the content. A grid may technically fit while one heading, image, label, or button still becomes awkward.

Check for horizontal overflow

In your browser’s Console, you can run this diagnostic snippet:

const viewport = document.documentElement.clientWidth;
const pageWidth = document.documentElement.scrollWidth;

console.log({ viewport, pageWidth, overflows: pageWidth > viewport });

If overflows is true, inspect elements near the page edges. Common causes include fixed widths, long unbreakable strings, excessive padding, and grid children that cannot shrink.

This snippet detects document-level overflow; it does not find every possible clipped component. Always inspect the visible page as well.

Prompt: Request a targeted responsive fix

I am testing the Northline Studio page at 320px.

Observed problem:
[Describe the exact element that overflows or overlaps.]

Expected result:
The page must fit without horizontal scrolling, and all
text and interactive controls must remain visible.

Relevant code:
[Paste only the affected HTML and CSS rules.]

Please:
1. Identify the likely root cause.
2. Suggest the smallest safe change.
3. Preserve the desktop layout and existing class names.
4. Explain how to verify the fix at 320px, 768px,
   and 1024px.
5. Do not rewrite unrelated files.

Do not paste a generic “fix responsiveness” prompt when you already know which element has failed. A precise bug report is much easier to evaluate.


Step 7: Review Accessibility, Content, and Code Quality

Responsiveness includes more than fitting content into a narrow viewport. People should be able to understand and use the website with keyboard navigation, screen readers, different zoom levels, and reduced-motion settings.

Prompt: Ask for a scoped accessibility review

Review the attached index.html, styles.css, and script.js.

Focus on:
- semantic landmarks and heading order
- valid, unique IDs and working anchor links
- keyboard navigation and visible focus
- mobile menu state and Escape behavior
- readable text and color contrast
- reduced-motion handling
- behavior without JavaScript
- overflow at narrow widths
- placeholder links and fictional demo content

Return a prioritized issue list with:
1. File and selector or line reference
2. Why it matters
3. The smallest proposed fix
4. How I can verify the result

Do not rewrite the entire project.
Do not claim you ran browser tests unless you actually did.

Independent checks you should perform

  • Keyboard: Press Tab from the top of the page. The skip link should become visible, links should be reachable in order, and focus should remain obvious.
  • Headings: Confirm there is one H1 followed by sensible H2/H3 headings. Do not choose heading levels for appearance alone.
  • Navigation: Check that all href="#..." values point to real element IDs. Test the mobile menu with keyboard input and assistive technology where available.
  • Zoom: Increase browser zoom to 200% and 400% and inspect whether content reflows and controls remain usable.
  • Motion: Enable reduced motion at the operating-system level and check that smooth scrolling is disabled.
  • Contrast: Use a contrast checker for normal text, links, buttons, and focus outlines. A blue-looking design is not automatically accessible.
  • Content honesty: Confirm that work examples are labeled fictional concepts and no demo text implies verified customers or projects.
  • Links: Replace the .example email address before using this layout for a real organization.
  • Security: Verify that the site has no unnecessary scripts, dependencies, secrets, or untrusted dynamic HTML.

Do not mistake a code review for a browser test

AI can suggest that a layout is responsive by reading the CSS, but it cannot prove how the page renders on your devices unless it has actually executed an appropriate browser test. Treat its review as a starting point and verify independently.

Checkpoint: The page is understandable without images, keyboard focus is visible, the mobile menu behaves correctly, and visual checks do not reveal clipped or overlapping content.


Step 8: Debug Carefully and Prepare the Website for Publication

Once the page looks good, do a final pass for maintainability and readiness. This tutorial’s example is a local demo, so some production tasks remain deliberately outside scope.

Prompt: Request a final QA report

I have completed the Northline Studio demo.

Review the final three files against the original brief.
Return a concise QA report with these categories:
- Content and section completeness
- Responsive breakpoints and layout risks
- Keyboard and screen-reader considerations
- JavaScript behavior and progressive enhancement
- Link validity and placeholder content
- Security and unnecessary dependencies
- Next steps for deployment

For each issue, identify the affected file and
provide a minimal correction. Separate verified facts
from assumptions and tests I still need to perform.
Do not modify files without explaining the changes.

Final publication checklist

  • [ ] All page sections match the project brief.
  • [ ] index.html, styles.css, and script.js are saved in the same folder.
  • [ ] All internal anchors point to existing sections.
  • [ ] Mobile and desktop layouts have been checked in a browser.
  • [ ] The mobile menu works with mouse, touch, and keyboard.
  • [ ] No unexpected errors appear in the browser Console.
  • [ ] Placeholder copy, concept projects, and contact details have been reviewed.
  • [ ] Real projects use appropriately licensed imagery and accurate claims.
  • [ ] The site has been checked for usability at larger text and zoom levels.
  • [ ] An accessibility audit and cross-browser testing are completed before production use.
  • [ ] If you deploy, the host serves HTML, CSS, and JavaScript over HTTPS.

How to run the finished example

You can open index.html directly in your browser because this version does not fetch remote data, import modules, or use an API. For a workflow closer to production, use a simple local development server or your editor’s local preview server.

Publishing the demo requires a static hosting service or web server that can serve the three files. Hosting configuration, DNS, and deployment commands vary by provider, so follow your chosen host’s current documentation.


Common Problems and Solutions

The page looks completely unstyled

Make sure your CSS file is named styles.css and is stored next to index.html. Confirm this line exists inside <head>:

<link rel="stylesheet" href="styles.css">

Also check the Network panel for a missing stylesheet request if you are using a local server.

The mobile menu button does nothing

Verify that script.js exists, is referenced with defer, and does not contain syntax errors:

<script src="script.js" defer></script>

Check that the HTML still includes .menu-toggle and #primary-nav. Open the Console and look for JavaScript errors.

Navigation links stay visible on mobile

This is intentional when JavaScript is disabled: visitors can still navigate. With JavaScript enabled, verify that the <html> element receives the js class after the script runs and that .js .site-nav and .js .site-nav.is-open exist in the mobile CSS rules.

The menu is open after resizing to desktop

Verify the matchMedia("(max-width: 767px)") query and its change listener. They should reset the menu state when the viewport crosses the breakpoint.

The cards remain stacked on a desktop screen

Make sure the media queries have not been removed or accidentally nested inside an unrelated selector. Verify that the viewport meta tag is present and that your styles are loading.

A page section is hidden or offset when an anchor is clicked

Check for fixed or sticky headers, the element ID, and the scroll-padding-top value. Adjust scroll offsets only if your actual header overlaps the destination.

There is horizontal scrolling at small widths

Inspect fixed widths, large unbreakable content, grid minimum sizing, and any absolutely positioned decorative elements. Avoid hiding the problem globally with overflow-x: hidden before identifying its cause.

The contact button does not send a real email

The address hello@northline.example is intentionally fictional. Replace it with a valid business address. A mailto: link opens a user’s configured email app; it does not create a backend contact form or guarantee that a message was sent.

Reusable AI Workflow for Your Next Website

When working on another project, you can reuse this compact prompt:

Help me build a responsive website in small, reviewable steps.

Business or project:
[Describe the purpose and audience.]

Pages and sections:
[List the required pages and sections in order.]

Technology:
[Choose HTML/CSS/JS or another appropriate stack.]

Design direction:
[Specify colors, typography, spacing, and references.]

Responsive requirements:
[Specify small-screen behavior and useful breakpoints.]

Accessibility and quality:
[Specify semantics, keyboard access, and test criteria.]

Constraints:
[List existing files, libraries to avoid, and scope limits.]

Workflow:
1. Begin with a brief implementation plan.
2. Generate one file or feature at a time.
3. Explain each substantial change.
4. Provide an independent verification checklist.
5. Suggest minimal fixes instead of broad rewrites.
6. Never claim tests ran unless they actually ran.

A practical prompting sequence

1. Plan the page.
2. Confirm the section structure.
3. Build semantic HTML.
4. Add mobile-first styling.
5. Add only the necessary JavaScript.
6. Test multiple widths and interaction states.
7. Fix observed issues with focused prompts.
8. Review accessibility, content, and deployment needs.

The process is more important than the specific AI product. A clearly written brief and small verifiable changes tend to be more dependable than asking for an entire production website in one response.

Best Practices for AI-Assisted Responsive Development

  • Keep the developer in control. AI drafts and explains; you evaluate and approve what is shipped.
  • Define content before layout. Realistic headlines and paragraphs reveal responsive problems that placeholder text may hide.
  • Use semantic HTML first. Good structure is easier to maintain, style, and navigate.
  • Start with the narrow layout. Enhance progressively instead of relying on last-minute mobile patches.
  • Prefer CSS for layout. Use JavaScript for behaviors that CSS and native HTML do not already handle.
  • Write measurable acceptance criteria. “No document-level horizontal scrolling at 320px” is more useful than “looks good on mobile.”
  • Treat AI-generated code as untrusted until verified. Read it, test it, and understand what it does.
  • Keep credentials out of prompts and front-end source files. This example needs none.
  • Avoid invented testimonials, unverifiable results, and unauthorized images. Demo content should be labeled as such.
  • Refine one problem at a time. Small, scoped corrections are easier to inspect and revert.

Conclusion

You have created a complete responsive landing page using an AI-assisted workflow: starting with a brief, mapping a wireframe, generating semantic HTML, designing mobile-first CSS, adding an accessible JavaScript menu, and reviewing the final result at multiple screen widths.

The most important lesson is that AI does not replace front-end judgment. It can speed up initial drafts and help you investigate bugs, but accessible navigation, credible content, responsive behavior, and deployment readiness still require your own verification.

With the same process, you can move from a single landing page to a multi-page business site, a portfolio, or a WordPress theme—without losing control of the code.

What to Build Next

Try replacing the fictional studio with your own project, adding a second page, and creating a reusable header/footer system. Keep the same checks for semantics, responsive behavior, keyboard access, and honest content. Change one thing at a time, and verify the result before moving forward.

Next tutorial: How to Debug JavaScript Errors Using ChatGPT.