ReferenceStyling
Edit this page

Styling

Global CSS Strategy

Reserve global CSS for tokens, resets, typography primitives, and syntax highlighting rather than route-specific layout work.

global-csstokensreset

A Bun-native SSR app gets fragile when global CSS becomes the dumping ground for route-specific styles. Keep it small.

Good global responsibilities

  • design tokens in :root
  • box sizing and element resets
  • global body typography
  • shared code block and syntax token styles
  • app-wide anchor defaults when truly intentional

What should not stay global

  • docs sidebar layout
  • route chrome
  • page cards and panels
  • search modal styling
  • markdown-page-specific layout rules unless scoped through a module bridge

Rules

  • Global CSS should be stable across routes.
  • If a selector only makes sense for one route tree, move it into a CSS Module.
  • Keep syntax highlighting global because highlighted tokens are generated markup, not component-owned classes.

Next step

Learn how the framework serves static files in Public Assets.