kitbash Sign in Connect agent
Components

Spread headline

Three light caps words pushed across the full width with a small caps line under the last, fading in letter by letter in random order; a Replay button plays it again. Below, a down link to the work and a contact block.

Part of the style

Quiet Page, Loud Work

7 parts that belong together, with their tokens, type and rules.

Preview

Code
<style>
/* Goes after the pack's base.css */
@import url("https://fonts.googleapis.com/css2?family=Figtree:wght@400..900&display=swap");
:root {
  --font: "Figtree", "Helvetica Neue", Arial, sans-serif;
}
</style>

<section class="headline" aria-labelledby="headline-title">
  <div class="headline__top">
    <h1 class="headline__title" id="headline-title" aria-label="Making loud websites for quiet companies">
      <span class="headline__word" aria-hidden="true">Making</span>
      <span class="headline__word" aria-hidden="true">Loud</span>
      <span class="headline__word headline__word--last" aria-hidden="true">Websites<span class="headline__sub">For quiet companies</span></span>
    </h1>
  </div>

  <div class="headline__foot">
    <a class="headline__down" href="#">
      <span>Things<br />we made</span>
      <svg class="headline__down-arrow" viewBox="0 0 13 13" aria-hidden="true"><path d="M1.5 1.5l10 10M11.5 3v8.5H3" /></svg>
    </a>

    <button class="headline__replay" type="button" aria-label="Replay the headline intro">
      <svg viewBox="0 0 16 16" aria-hidden="true"><path d="M13 8a5 5 0 1 1-1.6-3.7M13 2v3h-3" /></svg>
      Replay
    </button>

    <address class="headline__contact">
      <span class="headline__label">Open studio<br />Tue to Thu</span>
      <a class="headline__link" href="#">hello@otherhand.studio</a>
      <a class="headline__link" href="#">+31 20 555 0142</a>
    </address>
  </div>
</section>

<style>
  .headline {
    padding: 0 var(--edge);
    border-bottom: var(--hair) solid var(--rule);
  }
  .headline__top {
    padding: var(--hero-top) 0 var(--hero-bottom);
  }
  .headline__title {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin: 0;
    color: var(--ink-head);
    font-size: var(--text-hero);
    font-weight: var(--weight-light);
    line-height: var(--lead-hero);
    letter-spacing: var(--track-hero);
    text-transform: uppercase;
  }
  .headline__word {
    position: relative;
    white-space: nowrap;
  }
  .headline__sub {
    position: absolute;
    right: 0;
    top: 100%;
    font-size: var(--text-sub);
    line-height: 1;
    letter-spacing: 0;
    white-space: nowrap;
  }
  .headline__letter {
    opacity: 0;
    transition: opacity var(--t-letter) var(--ease-fade);
    transition-delay: var(--delay, 0ms);
  }
  .headline.is-shown .headline__letter {
    opacity: 1;
  }

  .headline__foot {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 24px;
    padding-bottom: 40px;
    opacity: 0;
    transition: opacity var(--t-reveal) var(--ease-fade) 1000ms;
  }
  .headline.is-shown .headline__foot {
    opacity: 1;
  }
  .headline__down {
    display: inline-flex;
    align-items: flex-end;
    gap: 8px;
    min-height: var(--tap);
    color: var(--ink);
    font-size: var(--text-m);
    line-height: var(--lead-text);
    text-transform: uppercase;
    text-decoration: none;
  }
  .headline__down-arrow {
    width: var(--arrow);
    height: var(--arrow);
    margin-bottom: 5px;
    fill: none;
    stroke: var(--accent);
    stroke-width: 1.3;
    transition: transform var(--t-arrow) var(--ease-out);
  }
  .headline__down:hover .headline__down-arrow,
  .headline__down:focus-visible .headline__down-arrow {
    transform: translate(3px, 3px);
  }
  .headline__replay {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    align-self: flex-end;
    min-height: var(--tap);
    padding: 0 4px;
    border: 0;
    background: none;
    color: var(--grey);
    font: inherit;
    font-size: var(--text-xs);
    text-transform: uppercase;
    cursor: pointer;
    transition: color var(--t-arrow) var(--ease-out);
  }
  .headline__replay svg {
    width: 13px;
    height: 13px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.3;
    transition: transform var(--t-open) var(--ease-out);
  }
  .headline__replay:hover,
  .headline__replay:focus-visible {
    color: var(--accent);
  }
  .headline__replay:hover svg {
    transform: rotate(-180deg);
  }
  .headline__contact {
    display: grid;
    justify-items: end;
    font-size: var(--text-xs);
    font-style: normal;
    line-height: var(--lead-text);
    text-align: right;
  }
  .headline__label {
    margin-bottom: -6px;
    color: var(--grey);
    text-transform: uppercase;
  }
  .headline__link {
    display: inline-flex;
    align-items: center;
    min-height: var(--tap);
    color: var(--ink);
    text-decoration: none;
    background: linear-gradient(var(--accent), var(--accent)) 0 100% / 0 var(--hair) no-repeat;
    transition: background-size var(--t-line) var(--ease-out);
  }
  .headline__link:hover,
  .headline__link:focus-visible {
    background-size: 100% var(--hair);
  }
  .headline a:focus-visible,
  .headline button:focus-visible {
    outline: var(--hair) solid var(--accent);
    outline-offset: 2px;
  }

  @media (max-width: 47.99rem) {
    .headline__title {
      flex-wrap: wrap;
      justify-content: flex-start;
      column-gap: 0.28em;
      font-size: clamp(36px, 10.6vw, 56px);
      line-height: 1.12;
    }
    .headline__sub {
      position: static;
      display: block;
      font-size: clamp(16px, 4.6vw, 22px);
      line-height: 1.2;
    }
    .headline__foot {
      flex-wrap: wrap;
    }
    .headline__contact {
      flex-basis: 100%;
      grid-auto-flow: column;
      justify-content: space-between;
      justify-items: start;
      align-items: end;
      text-align: left;
    }
    .headline__label { display: none; }
    .headline__link {
      min-height: var(--tap);
      font-size: var(--text-s);
      text-decoration: underline;
      text-underline-offset: 3px;
      text-decoration-thickness: var(--hair);
    }
  }
  @media (prefers-reduced-motion: reduce) {
    .headline__letter,
    .headline__foot {
      opacity: 1;
      transition: none;
    }
  }
</style>

<script>
  (() => {
    const WORD_START_MS = 150;
    const WORD_SPREAD_MS = 650;
    const SUB_START_MS = 850;
    const SUB_SPREAD_MS = 450;

    const splitIntoLetters = (textNode) => {
      const fragment = document.createDocumentFragment();
      for (const letter of textNode.textContent) {
        const span = document.createElement("span");
        span.className = "headline__letter";
        span.textContent = letter;
        fragment.append(span);
      }
      textNode.replaceWith(fragment);
    };

    const scatterDelays = (letters, start, spread) => {
      letters.forEach((letter) => {
        letter.style.setProperty("--delay", `${Math.round(start + Math.random() * spread)}ms`);
      });
    };

    const play = (root) => {
      const words = [...root.querySelectorAll(".headline__word > .headline__letter")];
      const sub = [...root.querySelectorAll(".headline__sub .headline__letter")];
      root.classList.remove("is-shown");
      void root.offsetWidth;
      scatterDelays(words, WORD_START_MS, WORD_SPREAD_MS);
      scatterDelays(sub, SUB_START_MS, SUB_SPREAD_MS);
      requestAnimationFrame(() => root.classList.add("is-shown"));
    };

    for (const root of document.querySelectorAll(".headline")) {
      root.querySelectorAll(".headline__word, .headline__sub").forEach((part) => {
        [...part.childNodes].filter((node) => node.nodeType === Node.TEXT_NODE).forEach(splitIntoLetters);
      });
      root.querySelector(".headline__replay").addEventListener("click", () => play(root));
      play(root);
    }
  })();
</script>

Similar components

Film reel

Film reel

Red clock field

Red clock field

Spring headline

Spring headline

HUD hero

HUD hero

Sticker headline hero

Sticker headline hero

Glass word with falling stickers

Glass word with falling stickers

Error screen

Error screen

Screensaver deck

Screensaver deck