# CSS nesting

*noun*

say it: **“SEE-ESS-ESS NEST-ing”** **/ˌsiːɛsˈɛs ˈnɛstɪŋ/**

Writing CSS rules inside another rule, so a component's parts, its states and its media queries sit together in one block.

## What is **CSS nesting**?

**CSS nesting** lets you write rules for child elements inside a parent rule, keeping related styles together.

```css
.card {
  padding: 16px;
  h3 { margin-top: 0; }
  &:hover { box-shadow: 0 2px 8px #0002; }
}
```

## In a sentence

- “With **CSS nesting**, the game card's heading, its button and its hover state all live inside one .game-card block.”

Level: Freelancer · [More CSS terms at this level](https://www.ask-codey.com/glossary?category=css&level=4)

Updated: November 9, 2026

Source: https://www.ask-codey.com/glossary/css-nesting
