Browse docs

Custom CSS for your website

Custom CSS changes your website’s look past what the theme, colors and fonts offer: a bigger title, square buttons, a different link color. Write it against the variables, attributes and classes listed here, and it keeps working as Telltail updates the site.

Where custom CSS applies

Type it into Website › Theme › Custom CSS. It’s added after the theme on every page of your website, and shows in three places:

  • The editor. The canvas beside the Theme controls and on each page shows it as soon as you leave the box.
  • Preview. A preview shows the draft, custom CSS included.
  • Your live site, once you press Publish. Custom CSS is part of the draft like the rest of the site: Publish lists it as a change, and restoring a version brings back that version’s custom CSS.

Custom CSS limits

Custom CSS holds at most 50,000 bytes. The box refuses some things outright and says which when you leave it:

@import, @namespace, url(), image-set(), image(), cross-fade(), src()
Each of these loads something from elsewhere. Custom CSS can’t load anything: no images, fonts or other stylesheets. Images go on the page with blocks, and fonts come from the Fonts setting.
<
Your CSS goes into the page inside a style tag, so it can’t hold anything that could end that tag.
A backslash, \
A backslash starts a CSS escape, and an escape can spell out a refused word.
The NUL character, and a lone surrogate (half of a pair that makes one character)
Characters that can’t be stored.

Upper and lower case are the same to the check, as they are to a browser, so URL( is refused too.

Variables

The theme and your color and font choices set these. Use them in your own rules, for example color: var(--color-primary), so your CSS follows when you change theme or colors. The theme sets them on the page itself, so to change one, set it on :root with !important.

--color-primary
The main color: primary buttons, bands and bars.
--color-on-primary
Text on the main color.
--color-accent
The second color: strips, badges and highlights.
--color-on-accent
Text on the second color.
--color-bg
The page’s background.
--color-surface
The footer’s background, and a Section set to Surface.
--color-card
The background of cards and panels.
--color-text
The page’s text.
--color-muted
Quieter text: brands, captions and notes.
--color-border
Rules and borders.
--color-link
Links in text.
--color-sale
A sale price.
--color-header-bg
The header’s background.
--color-header-text
The header’s text.
--font-body
The font of the page’s text.
--font-heading
The font of headings and the name.
--radius
The corners of cards, panels and images.
--control-radius
The corners of buttons, the search box and the filters.

Page attributes

The page’s html element carries these, so a rule can depend on the theme, for example html[data-scheme="dark"] .site-card.

data-theme
The theme. Values: classic, shopfloor, alpine, nightride, sunday, veloclub, gravel, boutique.
data-scheme
Whether the page is light or dark. Values: light, dark.
data-header
How the theme draws the header. Values: bar, band, centered, stripe, contour.
data-card
How the theme draws item cards. Values: flat, outlined, raised, topbar, tinted, centered.

Classes

site-header
The header at the top of every page.
site-wordmark
The shop’s name or logo in the header.
site-nav
The navigation, in the header and the footer.
site-page
A page’s blocks, between the header and the footer.
site-footer
The footer at the bottom of every page.
site-section
A Section block.
site-display
A page’s title: a hero’s heading, or a heading set to Title.
site-section-heading
A heading set to Heading, and the headings of Featured items and the Store list.
site-prose
The text of a Rich text block.
site-card
An item card, in the Inventory browser and Featured items.
site-button
Every button: Button blocks, a hero’s buttons, Book service and Search.

Blocks and buttons

Every block names its type on its outermost element, so [data-block="hours"] reaches every Hours block. Every button names the style, size and width chosen for it in the editor.

data-block
On every block’s outermost element: the block’s type. Values: section, columns, column, spacer, divider, richText, heading, hero, heroCta, image, carousel, video, button, inventory, featured, hours, location, storeList, bookService, bookingForm, contactForm.
data-button
On every button: its style. Values: primary, secondary, link.
data-size
On every button: its size. Values: small, medium, large.
data-width
On every button: fit (as wide as its words) or full (as wide as where it stands). Values: fit, full.

Examples

Larger page titles

.site-display {
  font-size: 3rem;
}

Square buttons

.site-button {
  border-radius: 0;
}

A hero’s buttons full width on phones

@media (max-width: 40rem) {
  [data-block="heroCta"] .site-button {
    width: 100%;
  }
}

Links in your accent color

:root {
  --color-link: var(--color-accent) !important;
}

Q&A

My rule doesn’t change anything. Why?

Check it reaches a listed class or attribute, and that the box took it (it says why when it doesn’t). To change a variable, set it on :root with !important.

Can I add JavaScript?

No. Custom CSS is the only code a shop can add. For measuring visits, add your Google Analytics or Meta pixel id in Website › Settings.

What happens to my CSS when I change theme?

It stays, added after whichever theme you pick. Rules written with the variables take the new theme’s colors and corners.