CSS

Custom stylesheet

Create style.css inside .moss/theme/ in your project folder (moss creates .moss/theme/ automatically when you open the folder). moss loads it after the default theme, so your rules override the defaults.

my-site/
├── .moss/
│   └── theme/
│       └── style.css   ← your custom CSS goes here
├── index.md
└── ...
:root {
  --moss-color-accent: #2d5a2d;
  --moss-font-body: "Inter", -apple-system, sans-serif;
  --moss-content-width: 72ch;
}

No build step, no config entry. The file is loaded automatically.

Self-hosted fonts

Drop .woff2 files in .moss/theme/fonts/ and reference them from your style.css with @font-face { src: url('fonts/myfont.woff2') }. The .moss/theme/ directory is served as a sibling of the site root.

Variables

Typography

VariableDefaultDescription
--moss-font-bodysystem sans-serif stackBody text font
--moss-font-headinginherits bodyHeading font
--moss-font-monoui-monospace, SFMono-RegularCode font
--moss-font-serifIowan Old Style, serif stackSerif font (used with font toggle)
--moss-font-size-base1.125remBase font size
--moss-font-weight320Default font weight

Colors

VariableDefaultDescription
--moss-color-accent#2d5a2dLinks, highlights, accent elements
--moss-color-bg#faf8f5Page background
--moss-color-text#2c2825Primary text
--moss-color-muted#8a8580Secondary/muted text
--moss-color-surface#f4f1ecCard and surface background

Layout

VariableDefaultDescription
--moss-content-width67chMaximum content width
--moss-content-width-sidebar62chContent width when sidebar is active
--moss-nav-widthvar(--moss-content-width)Navigation and footer max-width
--moss-sidebar-width280pxSidebar width
--moss-site-max-width1200pxMaximum overall site width
--moss-container-paddingclamp(1rem, 5vw, 2rem)Container side padding

Spacing

VariableDefaultDescription
--moss-space-xs0.5remExtra small (8px)
--moss-space-sm1remSmall (16px)
--moss-space-md1.5remMedium (24px)
--moss-space-lg2remLarge (32px)
--moss-space-xl3remExtra large (48px)
--moss-space-2xl4remDouble extra large (64px)

Dark mode

Dark mode follows the system preference automatically. Target the dark mode selector to customize:

[data-theme="dark"] {
  --moss-color-bg: #0f0f0f;
  --moss-color-accent: #6abf6a;
}

Component classes

Auto-generated components use stable .moss-* class names. Target these in your style.css.

Collection grid

ClassElement
.moss-collection-gridGrid container
.moss-collection-cardIndividual card
.moss-collection-card-coverCover image wrapper
.moss-collection-card-contentContent section below cover
.moss-collection-card-titleCard title
.moss-collection-card-countArticle count / subtitle

Child summary

ClassElement
.moss-child-summarySummary card
.moss-child-summary-rowFlex row (body + cover)
.moss-child-summary-bodyText content area
.moss-child-summary-metaDate or count
.moss-child-summary-titleTitle
.moss-child-summary-descriptionDescription excerpt
.moss-child-summary-coverSide cover image

Article list

ClassElement
.moss-article-listingListing container
.moss-article-itemIndividual list item
.moss-prefix-linkLink with prefix (date/count)
.moss-prefix-link-prefixPrefix portion (date/count label)
.moss-prefix-link-titleTitle portion
.moss-prefix-link-suffixSuffix portion (optional trailing label)
.moss-year-groupYear section heading
.moss-year-group--summaryYear group in summary style
.moss-child-section-dividerDivider between child sections

Grid shortcode

ClassElement
.moss-gridGrid container (:::grid N)
.moss-grid-cardIndividual grid cell
.moss-grid-card.friend-cardGrid cell wrapping an external link (auto-fetches metadata)
.moss-grid-card.link-cardGrid cell wrapping an internal article link

Collection cover

ClassElement
.moss-collection-coverFull-width cover section at top of folder page
.moss-collection-cover-rowFlex row inside cover
.moss-collection-cover-bodyText content area of cover
.moss-cover-labelLabel text inside a collection cover

Hero shortcode

ClassElement
.moss-heroHero container (:::hero)
.moss-hero-contentOverlay text region inside hero

Buttons shortcode

ClassElement
.moss-buttonsButton row container (::::buttons)
.moss-buttons.invertedLight-on-dark button row variant
.moss-btnIndividual button
.moss-btn-primaryFirst (primary) button
.moss-btn-secondarySubsequent (secondary) buttons
ClassElement
.moss-galleryGallery container (:::gallery)
.moss-gallery-itemIndividual gallery image

Callouts

ClassElement
.calloutShared callout wrapper
.callout-<type>Type-specific modifier (e.g. .callout-note, .callout-warning, .callout-pending)
.callout-titleCallout title row
.callout-contentCallout body content

Folder items (auto-generated section lists)

ClassElement
.moss-folder-itemRow in a folder listing
.moss-folder-linkLink within a folder item
.moss-folder-titleTitle within a folder item
.moss-folder-descriptionDescription within a folder item

Series navigation

ClassElement
.moss-series-navSeries navigation block
.moss-series-nav-linksPrev/next link container
.moss-series-nav-linkIndividual prev or next link
.moss-series-nav-prevPrevious article link
.moss-series-nav-nextNext article link
.moss-series-nav-arrowArrow glyph inside a series link
.moss-series-nav-titleArticle title inside a series link
.moss-series-nav-collection-rowRow showing which collection this belongs to
.moss-series-nav-collectionCollection name/link in series nav

Miscellaneous

ClassElement
.moss-colophonColophon / footer annotation block
.moss-summary-layoutSummary layout wrapper

Shortcode classes

Add custom classes to shortcode blocks with {.class} syntax:

:::grid 3 {.profiles .featured}
...
:::

Then target them in CSS:

.profiles .moss-grid-card {
  border-radius: 50%;
}

Layout in the class, not inline

For responsive column ratios, define grid-template-columns on your class and omit the ratio on the shortcode — :::grid 2 {.two-col-split} instead of :::grid 2 2:1 {.two-col-split}. Passing a ratio emits an inline style="" on the container, which beats @media rules and forces !important overrides.

.two-col-split {
  grid-template-columns: 2fr 1fr;
  gap: 2rem;
}
@media (max-width: 768px) {
  .two-col-split { grid-template-columns: 1fr; }
}

See shortcodes#Custom layouts with CSS classes for the full pattern.

Published with moss