I saw a .class1 ~ .class2
selector today, and had to look it up.
div ~ p {}
Selects every The And then there's the Selects all Am I right to think these are equivalent, or am I missing something? Answer In your specific scenario, these two selectors are equivalent, however not in more general scenarios. There is one important difference, the The elements represented by the two sequences share the same parent in Imagine this scenario: And please don't confuse the W3C, a serious institution standardizing web technologies, with w3schools which is a rather bad source for information! element that are preceded by a
would be selected, right?
+
selector:div + p {}
elements that are placed immediately after
+
combinator states:
the document tree and the element represented by the first sequence
immediately precedes the element represented by the second one.
No comments:
Post a Comment