kitbash Sign in Connect agent
Components

Masthead

Full-width slab wordmark, a navigation bar that sticks and picks up a small wordmark once the big one has scrolled away, and a statement in the right half. On phones the hero turns black and the links move into a full-screen menu with staggered items.

Part of the style

Wood Type Playbill

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

Preview

Code
<style>
/* Goes after the pack's base.css */
:root {
  --page: #030303;
  --ink: #c5c4c9;
  --ink-mid: rgba(197, 196, 201, 0.8);
  --ink-soft: rgba(197, 196, 201, 0.5);
  --paper: #000000;
  --night: #7e7d80;
  --poster-cream: #000000;
  --poster-cobalt: #5460a9;
  --poster-dusk: #454d78;
  --poster-red: #454b7a;
  --hot: #464c70;
  --plum: #767a8d;
  --tile-brick: #474b66;
  --poster-lemon: #3f498f;
  --tile-olive: #13173a;
  --poster-mint: #454b7a;
  --tile-forest: #666fc9;
  --tile-leaf: #252078;
  --poster-neon: #3f498f;
  --poster-heather: #2e3348;
  --tile-violet: #7179ac;
  --tile-sky: #3f498f;
}
</style>

<header class="masthead">
  <a class="masthead__wordmark" href="#" aria-label="Holler Press, home">
    <svg class="masthead__type masthead__type--full" viewBox="3 0 728 60.4" preserveAspectRatio="none" aria-hidden="true" focusable="false">
      <text x="0" y="59.4" textLength="731.7" lengthAdjust="spacingAndGlyphs">HOLLER PRESS</text>
    </svg>
    <svg class="masthead__type masthead__type--short" viewBox="3 0 388 60.4" preserveAspectRatio="none" aria-hidden="true" focusable="false">
      <text x="0" y="59.4" textLength="390.8" lengthAdjust="spacingAndGlyphs">HOLLER</text>
    </svg>
  </a>

  <div class="masthead__bar">
    <a class="masthead__logo" href="#" aria-label="Holler Press, home">
      <svg class="masthead__type masthead__type--full" viewBox="3 0 728 60.4" preserveAspectRatio="none" aria-hidden="true" focusable="false">
        <text x="0" y="59.4" textLength="731.7" lengthAdjust="spacingAndGlyphs">HOLLER PRESS</text>
      </svg>
      <svg class="masthead__type masthead__type--short" viewBox="3 0 388 60.4" preserveAspectRatio="none" aria-hidden="true" focusable="false">
        <text x="0" y="59.4" textLength="390.8" lengthAdjust="spacingAndGlyphs">HOLLER</text>
      </svg>
    </a>
    <nav class="masthead__nav" aria-label="Main">
      <a class="masthead__link" href="#">Prints &amp; Posters</a>
      <a class="masthead__link" href="#">Visit</a>
      <a class="masthead__link" href="#">About</a>
      <a class="masthead__link" href="#">Membership</a>
      <a class="masthead__button" href="#">Join</a>
    </nav>
    <button class="masthead__toggle" type="button" aria-expanded="false" aria-label="Open menu">
      <span class="masthead__toggle-line"></span>
      <span class="masthead__toggle-line"></span>
    </button>
  </div>

  <div class="masthead__lead">
    <div class="masthead__lead-body">
      <p class="masthead__statement">HAND-PULLED POSTERS. STUBBORNLY LOUD for streets that deserve better walls.</p>
      <p class="masthead__statement">Holler Press is a member-run print workshop putting big type and wet ink behind neighbourhood causes, gigs and good trouble.</p>
      <a class="masthead__more" href="#">Read the house rules</a>
    </div>
  </div>

  <div class="masthead__menu" inert>
    <ul class="masthead__menu-list">
      <li style="--i: 0"><a class="masthead__menu-link" href="#">Prints &amp; Posters</a></li>
      <li style="--i: 1"><a class="masthead__menu-link" href="#">Visit</a></li>
      <li style="--i: 2"><a class="masthead__menu-link" href="#">About</a></li>
      <li style="--i: 3"><a class="masthead__menu-link" href="#">Membership</a></li>
      <li style="--i: 4"><a class="masthead__menu-link" href="#">Join</a></li>
    </ul>
    <svg class="masthead__type masthead__type--stacked" viewBox="3 0 388 126" preserveAspectRatio="none" aria-hidden="true" focusable="false">
      <text x="197" y="59.4" text-anchor="middle">HOLLER</text>
      <text x="197" y="125" text-anchor="middle">PRESS</text>
    </svg>
    <ul class="masthead__social">
      <li><a class="masthead__social-link" href="#">Instagram</a></li>
      <li><a class="masthead__social-link" href="#">Bluesky</a></li>
      <li><a class="masthead__social-link" href="#">YouTube</a></li>
      <li><a class="masthead__social-link" href="#">Are.na</a></li>
    </ul>
  </div>
</header>

<style>
  /* The root makes no box, so the bar can stay stuck for the whole page, not just the header. */
  .masthead {
    display: contents;
  }

  /* The slab is drawn at 100px in a box as tall as its capitals, then pulled to the width and height the layout gives it. */
  .masthead__type {
    display: block;
    width: 100%;
    fill: currentColor;
    font: 900 100px var(--font-display);
  }
  .masthead__type--full {
    aspect-ratio: 728 / calc(60.4 * var(--display-stretch));
  }
  .masthead__type--short {
    aspect-ratio: 388 / calc(60.4 * var(--display-stretch));
  }
  .masthead__type--stacked {
    aspect-ratio: 388 / calc(126 * var(--display-stretch));
  }

  .masthead__wordmark {
    display: block;
    padding: 0.625rem var(--edge) 0;
    color: var(--ink);
  }
  .masthead__wordmark .masthead__type--short,
  .masthead__logo .masthead__type--short {
    display: none;
  }

  .masthead__bar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--gap);
    min-height: var(--bar-height);
    padding: 0 var(--edge);
  }
  .masthead__bar::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    background: color-mix(in srgb, var(--page) 72%, transparent);
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
    box-shadow: 0 1px 0 color-mix(in srgb, var(--ink) 12%, transparent);
    opacity: 0;
    transition: opacity var(--time) var(--ease);
  }
  .masthead--past-wordmark .masthead__bar::before {
    opacity: 1;
  }

  .masthead__logo {
    display: flex;
    align-items: center;
    width: 12.3rem;
    min-height: var(--tap);
    color: var(--ink);
    opacity: 0;
    visibility: hidden;
    translate: 0 0.5rem;
    transition: opacity var(--time) var(--ease), translate var(--time) var(--ease), visibility 0s var(--time);
  }
  .masthead--past-wordmark .masthead__logo {
    opacity: 1;
    visibility: visible;
    translate: 0 0;
    transition-delay: 0s;
  }

  .masthead__nav {
    display: flex;
    align-items: center;
    gap: var(--space-m);
    margin-left: auto;
  }
  .masthead__link {
    display: inline-flex;
    align-items: center;
    min-height: var(--tap);
    color: var(--ink);
    font-size: var(--text-m);
    font-weight: 800;
    text-decoration: underline 2px transparent;
    text-underline-offset: 0.22em;
    transition: text-decoration-color var(--time) var(--ease);
    white-space: nowrap;
  }
  .masthead__link:hover,
  .masthead__link:focus-visible {
    text-decoration-color: currentColor;
  }
  .masthead__button {
    display: inline-flex;
    align-items: center;
    min-height: 3.125rem;
    padding: var(--space-xs) var(--space-l);
    border-radius: var(--radius-button);
    background: var(--ink);
    color: var(--page);
    font-size: var(--text-m);
    font-weight: 800;
    text-decoration: none;
    transition: background var(--time) var(--ease), color var(--time) var(--ease);
  }
  .masthead__button:hover,
  .masthead__button:focus-visible {
    background: var(--paper);
    color: var(--ink);
  }
  .masthead__button:active {
    scale: 0.97;
    transition: scale var(--time-fast) ease-in-out;
  }

  .masthead__toggle {
    display: none;
    position: relative;
    width: var(--tap);
    height: var(--tap);
    margin-left: auto;
    padding: 0;
    border: 0;
    background: none;
    color: inherit;
    cursor: pointer;
  }
  .masthead__toggle-line {
    position: absolute;
    left: 0.375rem;
    right: 0.375rem;
    top: 50%;
    height: 2px;
    background: currentColor;
    translate: 0 -5px;
    transition: translate var(--time) var(--ease), rotate var(--time) var(--ease);
  }
  .masthead__toggle-line + .masthead__toggle-line {
    translate: 0 4px;
  }
  .masthead--open .masthead__toggle-line {
    translate: 0 0;
    rotate: 45deg;
  }
  .masthead--open .masthead__toggle-line + .masthead__toggle-line {
    rotate: -45deg;
  }

  .masthead__lead {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    column-gap: var(--gap);
    padding: var(--space-xl) var(--edge) var(--section-space);
  }
  .masthead__lead-body {
    grid-column: 7 / -1;
  }
  .masthead__statement {
    margin: 0 0 var(--space-l);
    font-size: var(--text-l);
    font-weight: 800;
    line-height: 1.2;
    text-wrap: pretty;
  }
  .masthead__more {
    display: inline-flex;
    align-items: center;
    min-height: var(--tap);
    color: inherit;
    font-size: var(--text-m);
    font-weight: 800;
    text-decoration: underline 2px currentColor;
    text-underline-offset: 0.22em;
    transition: text-decoration-color var(--time) var(--ease);
  }
  .masthead__more:hover,
  .masthead__more:focus-visible {
    text-decoration-color: transparent;
  }

  .masthead__menu {
    position: fixed;
    inset: 0;
    z-index: 15;
    display: flex;
    flex-direction: column;
    gap: var(--space-l);
    padding: var(--space-s) var(--gutter) var(--space-m);
    overflow-y: auto;
    overscroll-behavior: contain;
    background: var(--ink);
    color: var(--paper);
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--time) var(--ease), visibility 0s var(--time);
  }
  .masthead--open .masthead__menu {
    opacity: 1;
    visibility: visible;
    transition-delay: 0s;
  }
  .masthead__menu-list,
  .masthead__social {
    margin: 0;
    padding: 0;
    list-style: none;
  }
  .masthead__menu-link {
    display: inline-flex;
    align-items: center;
    min-height: var(--tap);
    color: inherit;
    font-size: 2rem;
    font-weight: 900;
    line-height: 1.05;
    text-decoration: none;
  }
  .masthead--open .masthead__menu-list li {
    animation: masthead-item-in var(--time-slow) var(--ease) both;
    animation-delay: calc(var(--stagger-start) + var(--i) * var(--stagger-step));
  }
  @keyframes masthead-item-in {
    from {
      opacity: 0;
      translate: 0 1.25rem;
    }
  }
  .masthead__type--stacked {
    width: min(100%, 24rem);
    margin: auto auto 0;
    flex: none;
  }
  .masthead__social {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 0 var(--space-s);
  }
  .masthead__social-link {
    display: inline-flex;
    align-items: center;
    min-height: var(--tap);
    color: color-mix(in srgb, var(--paper) 62%, transparent);
    font-size: var(--text-xs);
    font-weight: 800;
    text-decoration: underline 2px currentColor;
    text-underline-offset: 0.22em;
  }

  .masthead :focus-visible {
    outline: var(--rule-thick) solid currentColor;
    outline-offset: 4px;
  }

  @media (max-width: 56rem) {
    .masthead__wordmark {
      display: grid;
      place-items: center;
      min-height: 62svh;
      padding: 6.5rem var(--gutter) 2.5rem;
      background: var(--ink);
      color: var(--paper);
    }
    .masthead__wordmark .masthead__type--full,
    .masthead__logo .masthead__type--full {
      display: none;
    }
    .masthead__wordmark .masthead__type--short,
    .masthead__logo .masthead__type--short {
      display: block;
    }
    .masthead__wordmark .masthead__type--short {
      max-width: 30rem;
    }

    .masthead__bar {
      position: fixed;
      left: 0;
      right: 0;
      color: var(--paper);
      transition: color var(--time) var(--ease);
    }
    .masthead--past-wordmark .masthead__bar::before {
      opacity: 0;
    }
    .masthead--past-hero .masthead__bar {
      color: var(--ink);
    }
    .masthead--past-hero .masthead__bar::before {
      opacity: 1;
    }
    .masthead--open .masthead__bar {
      color: var(--paper);
    }
    .masthead--open .masthead__bar::before {
      opacity: 0;
    }
    .masthead__logo,
    .masthead--past-wordmark .masthead__logo {
      width: 5.9rem;
      color: inherit;
      opacity: 0;
      visibility: hidden;
      translate: 0 0.5rem;
    }
    .masthead--past-hero .masthead__logo {
      opacity: 1;
      visibility: visible;
      translate: 0 0;
      transition-delay: 0s;
    }
    .masthead--open .masthead__logo {
      opacity: 0;
      visibility: hidden;
    }
    .masthead__nav {
      display: none;
    }
    .masthead__toggle {
      display: block;
    }

    .masthead__lead {
      display: block;
      margin-bottom: var(--section-space);
      padding: var(--space-s) var(--gutter) var(--section-space);
      background: var(--ink);
      color: var(--paper);
      text-align: center;
    }
    .masthead__statement {
      max-width: 34rem;
      margin-inline: auto;
      font-size: var(--text-m);
    }
  }

  @media (prefers-reduced-motion: reduce) {
    .masthead__bar::before,
    .masthead__logo,
    .masthead__toggle-line,
    .masthead__menu {
      transition-duration: 0s;
    }
    .masthead__logo {
      translate: 0 0;
    }
    .masthead--open .masthead__menu-list li {
      animation: none;
    }
  }
</style>

<script>
  (() => {
    const PAST_WORDMARK = "masthead--past-wordmark";
    const PAST_HERO = "masthead--past-hero";
    const OPEN = "masthead--open";

    const flagWhenScrolledPast = (root, target, flag) => {
      const update = ([entry]) => root.classList.toggle(flag, !entry.isIntersecting && entry.boundingClientRect.top < 0);
      new IntersectionObserver(update).observe(target);
    };

    const setUpMenu = (root) => {
      const toggle = root.querySelector(".masthead__toggle");
      const menu = root.querySelector(".masthead__menu");

      const setOpen = (open) => {
        root.classList.toggle(OPEN, open);
        menu.inert = !open;
        toggle.setAttribute("aria-expanded", String(open));
        toggle.setAttribute("aria-label", open ? "Close menu" : "Open menu");
      };

      toggle.addEventListener("click", () => setOpen(!root.classList.contains(OPEN)));
      menu.addEventListener("click", (event) => {
        if (event.target.closest("a")) setOpen(false);
      });
      root.addEventListener("keydown", (event) => {
        if (event.key !== "Escape" || !root.classList.contains(OPEN)) return;
        setOpen(false);
        toggle.focus();
      });
    };

    document.querySelectorAll(".masthead").forEach((root) => {
      flagWhenScrolledPast(root, root.querySelector(".masthead__wordmark"), PAST_WORDMARK);
      flagWhenScrolledPast(root, root.querySelector(".masthead__lead"), PAST_HERO);
      setUpMenu(root);
    });
  })();
</script>

Similar components

Masthead

Masthead

Masthead

Masthead

Floating pill nav

Floating pill nav

Colour bar menu

Colour bar menu

Corner nav with stepped panels

Corner nav with stepped panels

Corner masthead

Corner masthead

Boxed nav cells

Boxed nav cells

Dark top bar

Dark top bar