---
title: "implicit-nesting-selector"
description: "Reports a custom variant selector without &, which matches descendants."
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.

# implicit-nesting-selector

This rule reports a `@custom-variant` selector without `&`. Without `&`, the
selector matches descendants of the element, not the element itself. In the
example, `hocus:` would match hovered elements inside the element.

## Reported

```css
@custom-variant hocus (:hover);
```

> implicit-nesting-selector: variant selector `:hover` is relative to `&` and means `& :hover`; write the `&`, or add `scope(document)` to the definition to select a document-level element
> 
> Example:1:24

## Fixed

```css
@custom-variant hocus (&:hover);
```

## How to fix

- Add `&` where the element belongs in the selector, as in the example.
- If the variant should match descendants, write that explicitly, such as
  `(& :hover)`.

## Rule settings

| Preset | Severity |
| --- | --- |
| `recommended` | warn |
| `strict` | deny |
| `stylistic` | off |

[Configure lint](/docs/configuration#lint) to change the severity or options.

Source: https://stillwind.dev/docs/lints/implicit-nesting-selector/index.mdx
