Get AI summaries of any video or article — Sign up free
[[Zettlr HowTo]] #005: Custom CSS thumbnail

[[Zettlr HowTo]] #005: Custom CSS

Zettlr·
5 min read

Based on Zettlr's video on YouTube. If you like this content, support the original creators by watching, liking and subscribing to their content.

TL;DR

Zettlr’s custom CSS loads after geometry and theme CSS, so matching selectors in custom CSS override built-in styling via the CSS cascade.

Briefing

Zettlr’s custom CSS feature lets users override the app’s built-in styling—down to layout, typography, colors, and borders—by injecting their own CSS rules into the editor. Because Zettlr runs on Electron (Chrome wrapped in a binary), its appearance is governed by CSS, meaning a user with basic CSS familiarity can reshape the interface far beyond the five shipped themes. The payoff is a fully personalized writing workspace, but the power also comes with risk: poorly targeted rules can make the UI unreadable or inconsistent.

The workflow starts with choosing a starting theme (the app ships with five themes, including Bordeaux). Themes control key visual defaults such as highlighting color and fonts, while a shared “geometry” CSS file handles element positioning and sizing. Zettlr then loads a theme-specific CSS file that adjusts colors, borders, and border radiuses. Finally, the user’s custom CSS file loads last, and CSS’s cascade rules mean later declarations override earlier ones—so custom CSS can supersede Zettlr’s own styling.

Before editing CSS, two prerequisites matter: having a clear idea of what to change and having at least some comfort with CSS. Zettlr also requires enabling debug mode to access developer tools. Users go to Preferences → Advanced, turn on debug mode, save, and then a new “develop” menu appears. Inside developer tools, the Elements tab is the key. It shows the DOM structure and the CSS rules currently affecting selected elements.

From there, users can “inspect” the interface directly: a selection tool lets them hover over UI components and click to lock onto the corresponding element in the Elements panel. This is especially important because styling often comes from wrapper elements rather than the inner content. For example, heading sizes are determined by CSS rules tied to CodeMirror wrapper classes, not just the visible heading text. Once the relevant selector is identified, users can adjust properties like font-size (using units such as em) and immediately see the effect.

To implement changes safely, the transcript recommends experimenting in developer tools first, then copying the CSS selector and the customized declarations into Zettlr’s Custom CSS settings dialog. After saving, Zettlr reloads the custom CSS instantly, and overridden rules appear “struck out” in the developer tools—confirming the cascade is working as intended.

Finally, the customization is theme-sensitive: switching themes can make the same custom CSS look completely different because the underlying theme CSS changes the baseline. Users are also encouraged to share standout customizations, with developers likely to credit and publicly highlight community CSS creations on forums and social platforms.

Cornell Notes

Zettlr’s custom CSS feature lets users override the app’s built-in styling by injecting their own CSS rules after the app loads its geometry and theme styles. Because Zettlr is built on Electron (Chrome in a binary), its interface is controlled by CSS, so later CSS rules win via the cascade. To customize effectively, users enable debug mode in Preferences to access developer tools, then use the Elements tab to inspect UI elements and identify the exact CSS selectors (often on wrapper elements). After experimenting with properties like font-size and colors in developer tools, users copy the selector and declarations into Zettlr’s Custom CSS dialog and save to see instant updates. Custom CSS depends on the chosen theme, so switching themes can change the final look.

How does Zettlr’s CSS loading order determine what custom styling “wins”?

Zettlr loads three layers of CSS: a geometry file (positioning and sizing rules), a theme file (colors, borders, border radiuses, and other theme-specific styling), and then the user’s custom CSS as the last file. CSS cascade rules mean later declarations override earlier ones, so custom CSS can supersede Zettlr’s own theme and geometry styling when selectors match.

Why is debug mode necessary for custom CSS work in Zettlr?

Custom CSS requires knowing which selectors control the interface. Zettlr’s debug mode unlocks a “develop” menu that provides developer tools. Those tools—especially the Elements tab—allow users to inspect the DOM and see which CSS rules apply to a selected element, making it possible to target the right selector instead of guessing.

What’s the practical method for finding the right CSS rule to change?

Use the developer tools selection tool in the Elements tab: hover over UI elements to see them highlighted, then click to lock the selection. The Elements panel shows the DOM structure and the CSS rules affecting that element. The transcript notes that styling may be driven by wrapper elements (for example, CodeMirror-related wrappers) rather than the inner visible text, so selecting the correct element is crucial.

How can a user adjust heading size without directly editing the visible heading text?

Heading sizing is controlled by CSS rules tied to CodeMirror wrapper classes. After inspecting the relevant element, users can modify the associated font-size property (e.g., changing a font-size value expressed in em units). Developer tools can even help with incremental changes (like using arrow keys) to quickly test different sizes before committing changes.

What’s the recommended workflow for turning experiments into a persistent custom CSS rule?

First, experiment in developer tools by changing CSS properties and confirming the visual result. Then copy the CSS selector and the customized declarations from the Elements panel into Zettlr’s Custom CSS dialog. Save the settings; Zettlr reloads custom CSS immediately, and overridden rules should appear as superseded in the developer tools.

Why can switching Zettlr themes break or change the look of existing custom CSS?

Themes change the baseline styling—colors, fonts, borders, and other properties—so the same custom CSS may override different underlying rules depending on the active theme. The transcript warns that switching themes can make the interface look completely different even if the custom CSS text stays the same.

Review Questions

  1. What CSS files does Zettlr load before user custom CSS, and how does the cascade determine which rules apply?
  2. In developer tools, why might heading styling be controlled by wrapper elements rather than the inner heading text?
  3. What steps turn a CSS experiment in the Elements tab into a persistent customization in Zettlr?

Key Points

  1. 1

    Zettlr’s custom CSS loads after geometry and theme CSS, so matching selectors in custom CSS override built-in styling via the CSS cascade.

  2. 2

    Zettlr runs on Electron, meaning the interface is effectively a web page whose look is controlled by CSS rules.

  3. 3

    Enabling debug mode in Preferences → Advanced unlocks the develop menu and developer tools needed to inspect selectors.

  4. 4

    The Elements tab is the main tool: select UI elements to reveal the exact CSS rules affecting them, often on wrapper elements like those around CodeMirror.

  5. 5

    A practical workflow is to prototype changes in developer tools, then copy the selector and declarations into the Custom CSS dialog and save for instant reload.

  6. 6

    Custom CSS is theme-dependent; switching themes can significantly change the final appearance even with the same custom CSS rules.

Highlights

Custom CSS is powerful because it loads last, letting users override Zettlr’s geometry and theme rules through standard CSS cascade behavior.
Developer tools are essential for precision: selecting elements in the Elements tab reveals the real selectors controlling styling, including wrapper-driven rules.
Zettlr reloads custom CSS immediately after saving, making iterative styling fast and testable.
Theme choice matters: the same custom CSS can look very different when the active theme changes.

Topics

Mentioned

  • DOM
  • CSS
  • CSS