Reference

Layout

Counters, media shapes, the grid and flex layout system, and the page-layout classes. Every reusable class, with the result on top and the markup below.

Rule

Divide sections with a horizontal rule.

Use a plain <hr> for an unlabeled divider between sections. Rule is a Svelte component for the less common case where the divider needs a visible label.


<hr />
import Rule from "$lib/Rule.svelte";

<Rule>Schedule</Rule>

Counters

Automatically number sections and list items.

.section-number prepends a section counter to an element in the form § 01 ·. Each use increments automatically, so sections number themselves. Use it on the label paragraph inside an <hgroup>.

Introduction

Getting started

Background

How it works

<hgroup>
<p class="section-number">Introduction</p>
<h2>Getting started</h2>
</hgroup>

<hgroup>
<p class="section-number">Background</p>
<h2>How it works</h2>
</hgroup>

.li-number prepends the list item's ordinal in monospace. Use it on navigation lists where the number should appear inside the link rather than outside it.

<nav>
  <ol>
    <li>
      <a class="li-number" href="#">Introduction</a>
    </li>
    <li>
      <a class="li-number" href="#">Background</a>
    </li>
    <li>
      <a class="li-number" href="#">Getting started</a>
    </li>
  </ol>
</nav>

Media

Crop an image or embedded content to a standard size.

.screen gives an element the site's standard 16:9 aspect ratio. Its content fills the element's box and is cropped to fit.

The EVO building, seen from the street
<img class="screen" src="facade.jpeg" alt="The EVO building, seen from the street" />

.square is similar, but with a 1:1 aspect ratio. Use it for portraits, or for images that sit together in a grid.

Gwen Shapira Jonathan Katz Melanie Plageman Steve Singer
<div class="grid-1:1">
  <img class="square" src="Gwen Shapira.jpeg" alt="Gwen Shapira" />
  <img class="square" src="Jonathan Katz.png" alt="Jonathan Katz" />
  <img class="square" src="Melanie Plageman.jpeg" alt="Melanie Plageman" />
  <img class="square" src="Steve Singer.jpeg" alt="Steve Singer" />
</div>

The crop on either .screen or .square is centered by default. Set object-position to choose which part of the image survives it, e.g. object-position: center 85% to keep the bottom of a tall photo.

Layout

Flex and grid containers, with responsive variants.

All layout classes zero out the block margins of their direct children, since gap handles the spacing between items.

None

none hides an element (with display: none). Its main use is with a responsive variant to show or hide content at specific viewport widths.

Flex

flex lays out children horizontally (in a flexbox), wrapping as needed. Use it for a row of buttons, badges, or other inline-sized elements.

<div class="flex">
  <button>Speakers</button>
  <button>Schedule</button>
  <button>Venue</button>
  <button>Workshops</button>
</div>

Grid

grid-A:B:… creates a fixed grid with one column per number, sized in that ratio. So grid-1:2:1 is three columns whose middle column is twice as wide as those on either side. Use it to build a custom grid layout.

1fr

2fr

1fr

<div class="grid-1:2:1">
  <p class="area">1fr</p>
  <p class="area">2fr</p>
  <p class="area">1fr</p>
</div>

grid/N is the equal-width special case: it divides children into exactly N equal columns, the same as grid-1:1:… repeated N times.

Column 1

Column 2

Column 3

<div class="grid/3">
  <p class="area">Column 1</p>
  <p class="area">Column 2</p>
  <p class="area">Column 3</p>
</div>

grid+N arranges children in a grid, with columns at least N rem wide, fitting as many as possible before wrapping. Use it for card grids where the number of columns should adapt to the available space.

Speaker A

Speaker B

Speaker C

Speaker D

<div class="grid+8">
  <p class="area">Speaker A</p>
  <p class="area">Speaker B</p>
  <p class="area">Speaker C</p>
  <p class="area">Speaker D</p>
</div>

subgrid lets a spanning grid item's children align with the outer grid's column tracks. In the example below, the two children inside the spanning item line up with the items in the row above.

Alpha

Beta

Gamma

Aligns with Alpha

Aligns with Beta

Gamma

<div class="grid/3">
  <p class="area">Alpha</p>
  <p class="area">Beta</p>
  <p class="area">Gamma</p>
  <div class="subgrid column-span-2">
    <p class="area">Aligns with Alpha</p>
    <p class="area">Aligns with Beta</p>
  </div>
  <p class="area">Gamma</p>
</div>

Page Grid

pagegrid turns a page-layout span (one of the Page Layout classes that covers more than one region, like (main) or main)) into a grid with one column per region, so its children line up with main and the sidebars. On its own it is a single-column grid; the span supplies the extra columns at each breakpoint.

The About page timeline uses (main main) pagegrid: a fallback between the boxes (main and main), so each row leans into the left sidebar on a desktop and the right one on a tablet, with the year in one column and its description in the other.

Column placement

column-N positions a grid item in column N. column-span-N stretches a grid item across N columns. To set where an item both starts and ends, add a second value: column-2-span-3 starts at column 2 and spans 3 columns, while column-2-4 runs from the start of column 2 to the start of column 4 (covering columns 2 and 3). span works in either position.

Column 1

Column 2

Forced to column 1

Spans columns 1–2

Starts at column 2, spans 2

Column 3

<div class="grid/3">
  <p class="area">Column 1</p>
  <p class="area">Column 2</p>
  <p class="area column-1">Forced to column 1</p>
  <p class="area column-span-2">Spans columns 1–2</p>
  <p class="area column-2-span-2">Starts at column 2, spans 2</p>
  <p class="area">Column 3</p>
</div>

Responsive variants

Any layout class (and none) can be scoped to a viewport width range by appending @min-max. min and max are rem values; either can be omitted.

Visible at 48rem and above

Speakers

Schedule

Venue

<!-- Resize viewport to ≥ 48rem to view -->
<p class="none@-48">
  Visible at 48rem and above
</p>

<!-- Side by side when viewport is ≥ 48rem -->
<div class="flex@48-">
  <p class="area">Speakers</p>
  <p class="area">Schedule</p>
  <p class="area">Venue</p>
</div>

Dedent

Remove list indentation for flex and grid layouts.

.dedent removes the markers and start padding from a list. Its main use is when you want to lay out list items with flex or grid while keeping their list semantics intact.

<ul class="flex dedent">
  <li><button>Speakers</button></li>
  <li><button>Schedule</button></li>
  <li><button>Venue</button></li>
  <li><button>Workshops</button></li>
</ul>

On a <dd> or parent <dl>, it removes the start indent from definition values — useful when laying out a <dl> in a grid.

Date
May 11–14, 2027
Location
Montréal, QC
Format
3+ tracks × 4 days
<dl class="grid+12 dedent">
  <div>
    <dt class="over">Date</dt>
    <dd>May 11–14, 2027</dd>
  </div>

  <div>
    <dt class="over">Location</dt>
    <dd>Montréal, QC</dd>
  </div>

  <div>
    <dt class="over">Format</dt>
    <dd>3+ tracks × 4 days</dd>
  </div>
</dl>