# CSS nesting

Writing child rules inside a parent rule.

## 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; }
}
```

Level: Freelancer · [More CSS terms at this level](https://www.ask-codey.com/glossary/subjects/css/freelancer)

Updated: September 27, 2026

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