---
title: "SW13004: CSS nesting limit exceeded"
description: "CSS rules or functions in your stylesheet are nested too deeply."
image: "https://stillwind.dev/og.png"
---

> Documentation Index
> Fetch the complete documentation index at: https://stillwind.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# SW13004: CSS nesting limit exceeded

This error occurs when blocks or functions in your stylesheet are nested deeper
than the compiler supports. The message gives the limit and the position where
the nesting exceeds it.

## Flatten selectors

Replace nested selectors with their full selector. For example:

```css
.card {
  & .content {
    & .title {
      color: blue;
    }
  }
}
```

The same rule needs no nested blocks:

```css
.card .content .title {
  color: blue;
}
```

This small example is within the limit. Apply the same transformation to the
deeply nested construct that the error identifies.

## How to fix

- Flatten nested rules, for example by writing the full selector instead of
  nesting it.
- Split a deeply nested value, such as many `calc()` calls inside each other,
  into custom properties.

Splitting the stylesheet into files does not help, because the limit applies to
one construct.

Source: https://stillwind.dev/docs/errors/SW13004/index.mdx
