Loading tutorials
>, +, ~), and pseudo-classes such as :hover and :nth-child(). The previous chapter covered what :has() does. This one covers how to write it.3 min read>) combinators, and basic specificity. It also assumes you have read the previous chapter on the :has() syntax.2 min read+) and general sibling (~) combinators. It also assumes you have read the previous chapters on :has() syntax and on matching descendants and direct children.3 min read:has() fits into that calculation, which is simpler than it first looks.2 min read:not() and :is() pseudo-classes in simple form, and how :has() matches descendants, children, and siblings. Here you will combine them. The order you nest them in changes the meaning, and this is the most common source of error3 min read:has() syntax and the state pseudo-classes :checked, :focus-visible, :invalid and :placeholder-shown. It also assumes you understand basic specificity.2 min read:has() with the child combinator (>), :nth-child(), and :not(). A quantity query is a selector that matches an element only when it has at least, at most, or exactly some number of children. Before :has(), these needed tricks with :nth-last-child() aimed at 2 min read:has() syntax, the difference between descendant and child matching, :not(), and the state pseudo-classes :checked, :focus-visible, and :invalid. You will combine them into three patterns you can reuse.2 min read:has() with relative selectors, including the >, + and ~ combinators. It also assumes you know basic specificity. Here you will learn where :has() stops working and how to rewrite selectors that hit those limits.2 min read:has() selectors with descendant, child and sibling arguments, and that you know how the cascade and style recalculation work at a basic level.3 min read:has() syntax, specificity, and @supports at a basic level. It covers which browsers support :has(), how to detect support, and how to keep a page usable where support is missing.2 min read:has() syntax from the earlier chapters and the DOM methods querySelector, querySelectorAll, matches, and closest. You will use :has() in those methods and learn where the results differ from what you may expect.2 min read