Skip to content

Layout and grid

A centered page, a 12-column grid and four breakpoints. Phones get one column; from tablets up, content takes the columns you give it.

CSS
css/base.css, css/components/panel.css, css/components/section-head.css

01 — The grid

Twelve columns

Put .grid on a container. Each child spans all 12 columns until you say otherwise. Gutters grow from 16px on a phone to 32px on a wide screen.

How to use it

  • .span-1 to .span-12 set how many columns a child takes.
  • .start-1 to .start-12 set the column it starts in. Combine them: class="span-9 start-4" runs from column 4 to 12.
  • Below 48rem (tablets) every child is full width, so phones get one column without extra classes.
  • Children that don’t fill a row wrap to the next one. Rows space themselves with row-gap (32px).
  • Nest a .grid inside a child to divide it again.

02 — Common layouts

Halves

Two equal columns: a form and its help, two cards.

span-6
span-6

Thirds

Three cards or figures.

span-4
span-4
span-4

Sidebar and content

A narrow column for a title or filters, and a wide one for content.

span-3
span-9

Editorial offset

Jewel’s signature: content panels start their content at column 4, under the section head, and leave the first three columns empty.

span-9 start-4

Centered

A narrow centered column for reading.

span-8 start-3

03 — Breakpoints

Four breakpoints, mobile first

Style the phone first, then add min-width rules. Custom properties can’t be read inside @media, so write the value and name the token beside it: @media (min-width: 48rem) { … } /* --bp-md */.

TokenValueWhat changes
--bp-sm40rem, 640pxLarge phones. Phone-only tweaks use max-width: 40rem; tables stack below it.
--bp-md48rem, 768pxTablets. The grid opens up and the header shows its links instead of the menu button.
--bp-lg64rem, 1024pxLaptops. The side nav becomes a column beside the content.
--bp-xl80rem, 1280pxThe page stops growing at --page-max.

04 — Page structure

The frame

A page is the background, the cap, then .page holding the sticky header and a column of content panels. The gradient shows between the panels.

HTML
<body>
  <div class="jewel-bg" aria-hidden="true"></div>
  <div class="jewel-cap" aria-hidden="true"></div>
  <div class="page">
    <header class="site-header">…</header>
    <main class="panel-stack">
      <section class="panel panel--pad grid">
        <header class="section-head"><p class="label">01 — Section</p></header>
        <div class="span-9 start-4">…</div>
      </section>
    </main>
  </div>
</body>

Section head

A numbered label opens each content panel. The rule under it runs to both edges of the panel. Content follows in span-9 start-4.

01 — Typography

One family, many voices

Content starts at column 4, under the label.

With a side nav

Wrap the page in .with-side-nav to put a sticky nav column beside the content from 64rem. This site is built that way; see Side nav.

HTML
<div class="with-side-nav">
  <aside class="with-side-nav__aside panel"><nav class="side-nav">…</nav></aside>
  <main class="panel-stack">…</main>
</div>

05 — Stacking order

Z-index

Use the scale, never a raw number. Sheets, the lightbox and pop-up menus open in the browser’s top layer, above everything.

Tokens
TokenValueWhat it’s for
--z-belowThe lava lamp animation
--z-baseNormal flow
--z-raisedBadges over photos, sticky table headers
--z-overlayHover cards inside a component
--z-capThe cap above the header
--z-stickyThe sticky header
--z-fabThe floating action button
--z-dropdownMenus, calendars, suggestions
--z-drawerThe side nav drawer
--z-toastToasts, skip links

06 — Usage

Use it for

  • .grid for page-level layout; .stack and .cluster inside components.
  • span-9 start-4 for the content of a content panel.
  • Letting phones fall back to one column.

Avoid

  • Fixed widths in pixels. Let the grid and --page-max decide.
  • A breakpoint value that isn’t one of the four.
  • Raw z-index numbers.

07 — Tokens

Tokens
TokenValueWhat it’s for
--grid-columnsColumns in .grid
--grid-gutterSpace between columns
--page-maxWidest the page gets
--page-marginSpace at the page edges
--panel-paddingInside a padded panel
--sticky-offsetGap above the header
--header-hHeader height
--side-nav-wSide nav column
--bp-smLarge phones
--bp-mdTablets
--bp-lgLaptops
--bp-xlWide screens
--layer-w-smMenus: minimum width
--layer-w-mdMenus: maximum width, drawer
--layer-w-lgFloating chat
--layer-hMenus scroll past this
--region-hTall code and tables scroll past this
--chat-hChat in a page