Blot

Customize callouts

Callouts inherit a set of default styles from Blot, but you can change their colors, borders, spacing, typography and icons in your template’s CSS. First, add a callout to a Markdown file, then open your site’s template in the dashboard and edit style.css.

Style every callout

Every callout has a callout class and a data-callout attribute. Use the class to apply the same style to all callouts:

.callout[data-callout] {
  border: 1px solid rgb(var(--callout-color));
  border-left-width: 0.25rem;
  border-radius: 0.5rem;
  padding: 1rem;
}

.callout-title {
  font-family: sans-serif;
  letter-spacing: 0.02em;
}

Blot defines --callout-color as three comma-separated RGB values. The default stylesheet uses it for the border, background, title and keyboard-focus outline, so changing the variable keeps those parts coordinated.

Customize a callout type

Target the data-callout attribute to customize a built-in type. For example, this changes every [!warning] callout:

.callout[data-callout="warning"] {
  --callout-color: 180, 83, 9;
  border-radius: 0;
}

.callout[data-callout="warning"] .callout-title {
  text-transform: uppercase;
}

You can also invent a type in Markdown:

> [!newsletter] Subscribe
> Get new posts delivered to your inbox.

Unknown types use the default note appearance. Blot preserves the type you wrote in data-callout-original, which you can use to give the custom type its own style:

.callout[data-callout-original="newsletter"] {
  --callout-color: 126, 76, 170;
  background: rgba(var(--callout-color), 0.12);
}

Add an icon with a ::before element

Each title contains an empty .callout-icon element. Add a visible icon without changing your template’s HTML by styling its ::before pseudo-element:

.callout[data-callout="tip"] .callout-icon::before {
  content: "\2605";
  display: inline-block;
  font-size: 1.1em;
  line-height: 1;
  margin-right: 0.5rem;
}

.callout[data-callout-original="newsletter"] .callout-icon::before {
  content: "\2709";
  display: inline-block;
  font-size: 1.1em;
  line-height: 1;
  margin-right: 0.5rem;
}

The icon container is hidden from assistive technology because it is decorative, so the callout title should still describe the callout. You can use a Unicode character, as above or replace content with an empty string and use a CSS background image or mask for a custom SVG icon.

Other useful selectors

/* The title row */
.callout-title { }

/* The title text, without the icon */
.callout-title-inner { }

/* The body */
.callout-content { }

/* A foldable callout */
.callout[data-callout-fold] { }

/* A foldable callout in its collapsed state */
.callout.is-collapsed { }

Keep your rules after any existing callout rules in style.css so that your overrides take precedence. For more about callout syntax, titles, types and folding, see the Markdown guide.