← Back to Responsive

Responsive pattern

Responsive hero section

A focused page opening with fluid type, readable copy, and actions that adapt to small screens.

Live example

See the pattern in isolation

The preview uses the same locked-down composition policy as the Agate IDE.

PreviewSandboxed

Canonical source

Copy it, change it, keep it plain

These exact files power the preview and the IDE handoff.

Source

HTML

<main class="hero" aria-labelledby="hero-title">
  <div class="hero__copy">
    <p class="hero__eyebrow">Independent neighborhood bakery</p>
    <h1 id="hero-title">Good bread takes its time.</h1>
    <p class="hero__summary">Naturally leavened loaves, laminated pastries, and a short lunch menu made each morning with local grain.</p>
    <div class="hero__actions">
      <a class="button button--primary" href="#today">See today’s bake</a>
      <a class="button button--secondary" href="#visit">Plan a visit</a>
    </div>
  </div>

  <aside class="hero__note" id="today" aria-labelledby="today-title">
    <p>From the oven</p>
    <h2 id="today-title">Sesame country loaf</h2>
    <p>Stone-milled wheat, toasted sesame, and a dark crust. Available from 8:00 until sold out.</p>
    <p id="visit"><strong>Open Tuesday–Sunday</strong><br>8:00–3:00</p>
  </aside>
</main>
Source

CSS

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: #f7efe6;
  color: #2b151d;
  font-family: system-ui, sans-serif;
}

.hero {
  display: grid;
  min-height: 100vh;
  grid-template-columns: minmax(0, 1.5fr) minmax(16rem, 0.65fr);
}

.hero__copy {
  display: grid;
  align-content: center;
  padding: clamp(2rem, 8vw, 7rem);
}

.hero__eyebrow,
.hero__note > p:first-child {
  margin: 0 0 1rem;
  color: #8e2f50;
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.hero h1 {
  max-width: 10ch;
  margin: 0;
  font-size: clamp(3rem, 9vw, 7.5rem);
  line-height: 0.88;
  letter-spacing: -0.055em;
}

.hero__summary {
  max-width: 52ch;
  margin: 1.75rem 0 0;
  color: #5c3b45;
  font-size: clamp(1rem, 2.2vw, 1.25rem);
  line-height: 1.6;
}

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

.button {
  display: inline-flex;
  min-height: 3rem;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1.1rem;
  border: 2px solid #2b151d;
  color: #2b151d;
  font-weight: 850;
  text-decoration: none;
}

.button--primary {
  background: #b0436a;
  color: #ffffff;
}

.button--secondary {
  background: transparent;
}

.button:hover {
  background: #2b151d;
  color: #ffffff;
}

.button:focus-visible {
  outline: 4px solid #176b87;
  outline-offset: 4px;
}

.hero__note {
  display: grid;
  align-content: end;
  padding: clamp(2rem, 6vw, 4rem);
  border-inline-start: 4px solid #2b151d;
  background: #d94f9d;
}

.hero__note > p:first-child {
  color: #2b151d;
}

.hero__note h2 {
  margin: 0;
  font-size: clamp(1.8rem, 4vw, 3rem);
  line-height: 1;
}

.hero__note p {
  line-height: 1.55;
}

@media (max-width: 46rem) {
  .hero {
    min-height: auto;
    grid-template-columns: 1fr;
  }

  .hero__copy {
    min-height: 72vh;
  }

  .hero__note {
    border-block-start: 4px solid #2b151d;
    border-inline-start: 0;
  }
}

@media (max-width: 28rem) {
  .hero__actions {
    align-items: stretch;
    flex-direction: column;
  }
}

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

How it works

A small pattern with visible decisions

The main heading stays prominent without overflowing because its size uses clamp(). Supporting copy keeps a readable measure, and the action row wraps before it becomes cramped.

The wide layout uses two unequal columns. A media query restores the natural reading order on smaller screens, while a second stacks the actions into full-width touch targets. Reduced-motion preferences disable smooth scrolling.

Make it yours

Open both files in the workspace.

Agate will protect different saved work before loading this example.