I'm wondering about CSS selectors. Especially about this one: "div p" vs "div > p"
Asked
Active
Viewed 70 times
0
Maik Lowrey
- 15,957
- 6
- 40
- 79
Pritom
- 9
- 2
-
1Did you read the docs ? [Descendant combinator](https://developer.mozilla.org/en-US/docs/Web/CSS/Descendant_combinator) VS [Child combinator](https://developer.mozilla.org/en-US/docs/Web/CSS/Child_combinator) – Gabriele Petrioli May 14 '22 at 14:07
-
div p selects all p elements which have a div element as an ancestor. div > p selects all p elements which are the direct children of div elements. See https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors – A Haworth May 14 '22 at 14:07
1 Answers
0
div p: all elements <p> inside <div> (including deeply nested elements)
div > p: all elements <p> which are direct children of <div>
Rashad Saleh
- 2,686
- 1
- 23
- 28
Maxim Povarnev
- 9
- 2