Suggest an editImprove this articleRefine the answer for “What is the difference between h1, h2, h3 and h1 h2 h3 in style declarations?”. Your changes go to moderation before they’re published.Approval requiredContentWhat you’re changing🇺🇸EN🇺🇦UAPreviewTitle (EN)Short answer (EN)**`h1, h2, h3`** (with a comma) applies the style to each selector separately, while **`h1 h2 h3`** (with a space) selects only `h3` nested inside `h2` nested inside `h1`. **Key point:** to give several elements a shared style, use a comma, not a space, since h1→h2→h3 nesting almost never occurs in real markup.Shown above the full answer for quick recall.Answer (EN)ImageThe difference is fundamental: it's **grouping** versus **nesting**. --- ### `h1, h2, h3` **- grouping** The comma means the style applies **to each selector separately**. ```css h1, h2, h3 { color: red; } ``` This rule colors **all** `h1`, **all** `h2`, and **all** `h3`, regardless of where they are in the document. --- ### `h1 h2 h3` **- nested selectors (descendants)** The space means the style applies **only to** `h3`**, which is inside** `h2`**, and** `h2` **- inside** `h1`. ```css h1 h2 h3 { color: red; } ``` This scenario practically never happens in reality, because the structure: ```html <h1> <h2> <h3>Text</h3> </h2> </h1> ``` - essentially impossible and violates HTML semantics. That's why such a selector will almost never work. --- ### **Summary** | Notation | What it means | Where it applies | |---|---|---| | `h1, h2, h3` | a style for each of the selectors | to *all* `h1`, `h2`, `h3` | | `h1 h2 h3` | a style for `h3` nested in `h2`, nested in `h1` | almost never seen | --- If you need to give several elements a shared style, use a **comma**, not a space.For the reviewerNote to the moderator (optional)Visible only to the moderator. Helps review go faster.