Epic CSS / Documentation

Grid

Use CSS Grid for rows and columns. Add grid for display, a column utility for the tracks, and a gap utility for spacing.

Selected fractional tracks

Choose a track pattern and a breakpoint explicitly. Each pattern changes columns at its minimum viewport width; combine it with grid to enable grid display. Below that breakpoint, these examples stack in source order.

One
Two
Three
HTML
<div class="grid grid-md-1fr-1fr grid-lg-1fr-1fr-1fr gap-16">
  <div class="docs-demo-item">One</div>
  <div class="docs-demo-item">Two</div>
  <div class="docs-demo-item">Three</div>
</div>
ClassMinimum viewport widthTracks
grid-md-1fr-4fr820px1fr 4fr (existing behavior)
grid-md-1fr-1fr820pxTwo equal tracks
grid-lg-1fr-2fr960pxOne share beside two shares
grid-lg-1fr-1fr-1fr960pxThree equal tracks

New patterns use minmax(0, 1fr) (or minmax(0, 2fr)) so tracks can shrink without imposing a fixed minimum width. Breakpoints follow the viewport, so allow room for the tracks inside your actual container. See the featured lesson and supporting grid for nested one-to-two and three-column patterns.

Customize selected patterns

Set $grid-patterns before importing the library, in src/my-epic-css/_custom.scss. The outer keys select existing breakpoints; inner keys become class suffixes, and values supply the track list. Only listed combinations are generated. This replaces the default map rather than merging it; keep any defaults your templates use.

$grid-patterns: (
  md: (
    "1fr-4fr": (1fr 4fr),
    "1fr-1fr": (minmax(0, 1fr) minmax(0, 1fr)),
  ),
  lg: (
    "1fr-2fr": (minmax(0, 1fr) minmax(0, 2fr)),
    "1fr-1fr-1fr": (minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr)),
  ),
);

Add a track pattern when needed

Three, four, five, or mixed-proportion tracks use the same generator. For four equal columns, insert this entry into your existing $grid-patterns map in _custom.scss, alongside the md and lg entries above:

xl: (
  "1fr-1fr-1fr-1fr": (minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr)),
),

The outer key xl selects 1200px. The inner key supplies the suffix for grid-xl-1fr-1fr-1fr-1fr; its track list becomes grid-template-columns. Names do not calculate the tracks: keep the key descriptive of its values. This is an illustrative configuration, not an included default. The class exists only after you configure it and recompile Sass.

<div class="grid grid-xl-1fr-1fr-1fr-1fr gap-24">
  <div>First idea</div>
  <div>Second idea</div>
  <div>Third idea</div>
  <div>Fourth idea</div>
</div>

grid enables display and gap-24 separates the tracks. With this markup, items occupy one implicit column below 1200px and four columns from 1200px. Add a different selected pattern to the map when you need five tracks or mixed proportions; unconfigured combinations are not generated.

For local development, run npm start in the consumer project to compile Sass and start the watchers. For the documentation site's filtered build, run npm run build. For the starter theme, run npm run epic-build, then npm run epic-light, then npm run build-production, allowing each command to finish. Stop development watchers before a filtered production build.

The separate $sidebar-widths map continues to generate fixed-width sidebar layouts. The former auto-fitting column helpers have been removed; choose explicit equal tracks for equal-column layouts.

Space between tracks

gap-16 sets both row and column gap to one rem. These are the current spacer keys:

0, 4, 6, 8, 10, 12, 16, 18, 20, 24, 32, 40, 56, 60, 64, 80, 100.

The values are rem-based Sass multipliers, not a general pixel parser. In the current scale both gap-16 and gap-18 resolve to one rem.

Combine grid, a sidebar utility, and a gap utility. Both sidebars use one minmax(0, 1fr) track below the lg breakpoint (960 pixels), then a fixed-width sidebar beside flexible main content. The breakpoint follows the viewport; allow enough container space for both tracks and the gap.

Put the sidebar first. The docs use grid grid-sidebar-left-lg-208px gap-32: a 208-pixel left track from 960 pixels, with a two-rem gap.

Sidebar
Main content
HTML
<div class="grid grid-sidebar-left-lg-208px gap-32">
  <div class="docs-demo-item">Sidebar</div>
  <div class="docs-demo-item">Main content</div>
</div>

Below 960 pixels, the sidebar and main content stack in HTML order. Put the sidebar first to keep it above the main content. To stack it below while keeping it on the left at 960 pixels and up, put the main content first in the HTML and add order-lg-last to that direct grid child. Reading and keyboard navigation still follow HTML order.

Put main content first. Use grid grid-sidebar-right-lg-344px gap-40 for a 344-pixel right track from 960 pixels, with a 2.5rem gap. See the posts and right-sidebar example.

Main content
Sidebar
HTML
<div class="grid grid-sidebar-right-lg-344px gap-40">
  <div class="docs-demo-item">Main content</div>
  <div class="docs-demo-item">Sidebar</div>
</div>
ClassTracks from 960 pixels
grid-sidebar-left-lg-208px208px minmax(0, 1fr)
grid-sidebar-right-lg-344pxminmax(0, 1fr) 344px

Customize sidebar widths

Set $sidebar-widths near the top of src/my-epic-css/_custom.scss, then rebuild Sass. The fallback map in _variables.scss uses !default, preserving a map assigned before the library is imported.

$sidebar-widths: (
  narrow: 208px,
  wide: 344px,
);

Each map value generates both left and right utilities: grid-sidebar-left-lg-208px, grid-sidebar-right-lg-208px, grid-sidebar-left-lg-344px, and grid-sidebar-right-lg-344px. Keep the narrow sidebar for navigation and use the wider left sidebar for author profiles.

Map keys label the settings; widths and units form the class names. Add medium: 280px to generate both grid-sidebar-left-lg-280px and grid-sidebar-right-lg-280px. Update HTML when changing an existing width. The map replaces the individual left/right width settings.

Replace the former fixed right-sidebar and percentage left-sidebar utilities with the configurable utilities and a separate gap utility. The former small-sidebar helper is removed. The fractional helper is now grid-md-1fr-4fr: combine it with grid for 1fr 4fr tracks from 820 pixels.

Containers and widths

ClassEffect
wrapperFive percent padding on each side.
containerCentered container with the Sass-configured maximum width: 1040 pixels on this site, with a 1000-pixel library fallback. See container customization.
container-postCentered container with an independently configured $container-post-width: 1000-pixel fallback and a 900-pixel custom setting. See post container customization.
w-100Full available width.
margin-automargin: 0 auto, resetting vertical margins and centering horizontally where the available width permits.

The retired breakpoint percentage-width helpers are no longer generated. Use fractional grid tracks to share available space after gaps, or an explicit inline max-width to cap a reading region while allowing it to fill narrower screens.