---
title: Custom CSS
description: Add custom CSS to override theme styles, tweak typography, or add brand-specific styling. Jamdesk exposes CSS variables for common customizations.
---

Jamdesk themes provide sensible defaults, but you can add custom CSS to match your brand or adjust specific styles.

## Adding Custom CSS

Create a CSS file in your docs directory and reference it in `docs.json`:

```json docs.json
{
  "styling": {
    "css": "/custom.css"
  }
}
```

```css custom.css
/* Your custom styles */
.content h1 {
  font-size: 2.5rem;
}
```

## CSS Variables

Jamdesk exposes CSS variables for common customizations. Override them in your custom CSS:

```css custom.css
:root {
  /* Typography */
  --font-family-sans: 'Inter', system-ui, sans-serif;
  --font-family-mono: 'JetBrains Mono', monospace;
  
  /* Spacing */
  --content-max-width: 900px;
  --sidebar-width: 280px;
  
  /* Border radius */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
}
```

### Color Variables

Primary colors are set in `docs.json`. For fine-grained control, override these variables:

```css custom.css
:root {
  /* Light mode */
  --color-background: #ffffff;
  --color-text: #1a1a1a;
  --color-text-muted: #666666;
  --color-border: #e5e5e5;
  --color-code-bg: #f5f5f5;
}

[data-theme="dark"] {
  /* Dark mode */
  --color-background: #0a0a0a;
  --color-text: #fafafa;
  --color-text-muted: #a3a3a3;
  --color-border: #262626;
  --color-code-bg: #171717;
}
```

## Common Customizations

### Adjust Content Width

```css
:root {
  --content-max-width: 1000px;  /* Default: 900px */
}
```

### Change Code Block Font

```css
:root {
  --font-family-mono: 'Fira Code', monospace;
}

/* Ensure ligatures work if your font supports them */
pre code {
  font-variant-ligatures: common-ligatures;
}
```

### Customize Link Styles

```css
.content a:not([class]) {
  color: var(--color-primary);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.content a:not([class]):hover {
  text-decoration-thickness: 2px;
}
```

### Adjust Heading Spacing

```css
.content h2 {
  margin-top: 3rem;
  margin-bottom: 1rem;
}

.content h3 {
  margin-top: 2rem;
  margin-bottom: 0.75rem;
}
```

### Style Callouts

```css
/* Make Note callouts more prominent */
[data-callout="note"] {
  border-left-width: 4px;
  background: var(--color-primary-subtle);
}
```

## Dark Mode

Use the `[data-theme="dark"]` selector for dark mode styles:

```css
/* Light mode */
.custom-banner {
  background: #f0f4ff;
  color: #1e3a5f;
}

/* Dark mode */
[data-theme="dark"] .custom-banner {
  background: #1e293b;
  color: #e2e8f0;
}
```

## Targeting Components

Override styles for specific components:

```css
/* Card component */
[data-component="card"] {
  border-radius: 16px;
}

/* Code blocks */
[data-component="code-block"] {
  border-radius: 8px;
}

/* Tabs */
[data-component="tabs"] [data-state="active"] {
  border-bottom-width: 3px;
}
```

## External Fonts

Load custom fonts with `@import` or `@font-face`:

```css
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
  --font-family-sans: 'Inter', system-ui, sans-serif;
}
```

Or self-host fonts:

```css
@font-face {
  font-family: 'CustomFont';
  src: url('/fonts/custom-font.woff2') format('woff2');
  font-weight: 400;
  font-display: swap;
}
```

## Responsive Styles

Use media queries for responsive adjustments:

```css
/* Mobile adjustments */
@media (max-width: 768px) {
  .content h1 {
    font-size: 1.75rem;
  }
  
  :root {
    --content-max-width: 100%;
  }
}
```

## Debugging

Use browser dev tools to inspect elements and find the correct selectors. Jamdesk uses data attributes for component targeting:

- `data-component="..."` - Component type
- `data-theme="light|dark"` - Current theme
- `data-state="..."` - Component state (active, disabled, etc.)

## Limitations

- CSS is applied globally; use specific selectors to avoid conflicts
- Some internal layout styles use `!important` and may require the same to override
- Changes require a rebuild to take effect

## What's Next?

<Columns cols={2}>
  <Card title="Theming" icon="palette" href="/customization/theming">
    Choose and configure themes
  </Card>
  <Card title="Branding" icon="image" href="/customization/branding">
    Logos, colors, and brand identity
  </Card>
</Columns>
