-2

I know it might seem stupid to compare these to combinators or selectors. But from the definition given in w3 schools, I find it confusing to differ between the two. Can someone please help clear out the difference?

Here's the link to the page: https://www.w3schools.com/css/css_combinators.asp

zahin_ahad
  • 11
  • 1
  • 1
    Don't try to learn from W3S, use a decent documentation that goes into more detail: https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors#Combinators – deceze Aug 21 '20 at 09:44
  • Explain _what_ you find “confusing” then. Although w3schools is not the best reference, it has examples and explanations for both there. So, what exactly are you having trouble understanding? – CBroe Aug 21 '20 at 09:44
  • Both of them can select all children except the first one. For example, `.child + .child` will select all children after first child, and `.child:not(:first-child)` will also select all children except first child. Are there any differences or which one is better?. So I think this question is good. – Nighon Mar 15 '23 at 02:16

1 Answers1

0

The adjacent sibling selector ( + ) matches the second element if it follows the first element, and they are both children of the same parent element"first_element + second_element". but the child selector matches the direct children of the specified parent "parent> direct child".

Mawadda
  • 7
  • 1
  • 8