> in HTML you have a tree of nodes but comments can be anywhere
Maybe I'm misunderstanding, but no they can't. For example the comment here is not a comment, but part of the URL:
<a href="https://example.com<!-- comment -->">click me</a>
And HTML like this is simply broken: <div<!-- comment -->>content</div>
Maybe you meant "they can be anywhere that a Node can be in the DOM", but I think that's more or less what the CSS "mistake" is suggesting should be true about CSS (just replace "DOM" with "CSSOM").
Yes, anywhere in the node tree. Imagine if CSS was specified in HTML-style. We might write this selector:
Like this: Which is pretty much exactly the same as what you'd get as a CST from parsing the CSS.