8 Matching Annotations
  1. Last 7 days
    1. This works somewhat well in practice, but there are many cases where the inference is incorrect. As a particularly egregious example, :not(#foo) targets all elements except one, yet enjoys the same high specificity as #foo.

      Explanation: #foo which ideally targets one element, is more specific that :not(#foo) because it targets every element except one. Didn't hit me the first time, thought might be beneficial for someone reading in a daze.

  2. Nov 2023
  3. Mar 2021
    1. Generally, CSS selectors refer to markup or, in some cases, to element properties as set with scripting (client-side JavaScript), rather than user actions. For example, :empty matches element with empty content in markup; all input elements are unavoidably empty in this sense. The selector [value=""] tests whether the element has the value attribute in markup and has the empty string as its value. And :checked and :indeterminate are similar things. They are not affected by actual user input.
  4. Sep 2020
    1. This sibling combinator is similar to X + Y, however, it's less strict. While an adjacent selector (ul + p) will only select the first element that is immediately preceded by the former selector, this one is more generalized. It will select, referring to our example above, any p elements, as long as they follow a ul.
  5. Nov 2019
  6. Aug 2019
    1. CSS syntax is awesome for two reasons: It is an order of magnitude faster and less resource intensive than the more complex XPath. When what you want to find can be found with a css selector, a corresponding XPath query doing the same would most of the time be much longer and harder to read.