0

HTML

<p class="xyz abc">blalblalba</p>

CSS

difference between selecting for p .xyz.abc and p .xyz .abc ?

as3113
  • 3
  • 1
  • You have a space after the p. Space is a combinator so the system will be looking for a descendant element with both class xyz and abc. I think you meant to ask without the space. In that case the answer is 'none'. The order here doesn't matter. What matters is the cascading order (which of them was defined last within the CSS cascading system). – A Haworth May 13 '22 at 15:06
  • p .xyz.abc (`p` is the parent and `.xyz.abc` is the child element) and p .xyz .abc (`p` is the parent element, followed by `.xyz` which is a child of `p`, following by `.abc` which is a child of `.xyz`)... All in all the first is two elements and the second is three elements. – Si8 May 13 '22 at 18:13

0 Answers0