Skip to main content

Typography, Colors & CSS Overrides

Because mdslide compiles your presentation into standard, semantic HTML pages, you can easily customize the typography, color themes, spacing, and borders of your slide decks using standard CSS variables inside a <style> block in your Markdown file.


Example Override

Simply declare your overrides inside a :root selector at the bottom of your Markdown file:

<style>
/* Import Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@400;700&family=Fira+Code&display=swap');

:root {
/* Font family overrides */
--slide-font: 'Outfit', sans-serif;
--slide-mono: 'Fira Code', monospace;

/* Theme colors */
--slide-bg: #0f172a; /* Deep slate background */
--slide-text: #f8fafc; /* Off-white text */
--slide-accent: #f43f5e; /* Rose accent highlight */

/* Global border radius */
--slide-radius: 10px;
}
</style>

CSS Variables Reference

Below is the list of custom CSS variables you can override to adjust your slides' styling:

1. Typography

CSS VariableDefault ValueDescription
--slide-fontSystem UI Sans-SerifMain font family for headings, lists, paragraphs, and cards.
--slide-monoSystem UI MonospaceFont family for code blocks and inline code tags.
--title-size3.6remFont size for primary slide titles.
--h2-size2.6remFont size for secondary headings.
--h3-size1.8remFont size for tertiary headings.
--body-size1.35remFont size for standard paragraph text.
--li-size1.3remFont size for list bullet items.
--code-size1.1remFont size inside code blocks.

2. Colors

CSS VariableCategoryDescription
--slide-bgSlide BackgroundSlide background color.
--slide-surfaceBlock BackgroundBackground color for quote boxes, code blocks, and card surfaces.
--slide-textTypography ColorMain body text and heading color.
--slide-mutedTypography ColorColor for secondary footnotes, captions, and muted elements.
--slide-accentBrand/HighlightsAccent color for link underlines, bullet markers, and borders.
--slide-borderBoundariesColor for divider lines and card borders.

3. Styling & Radii

CSS VariableDefault ValueDescription
--slide-radius6pxBorder-radius styling for card boxes, code containers, and images.