HTML & CSS · Middle · Question 26 of 75
What does the selector .card:has(img) match?
- ✓Correct answer: Cards that contain at least one
<img>image - 2All
<img>elements located inside.card - 3Cards that have an HTML attribute named
img
Explanation
:has() is the "parent selector": it matches an element if something inside it (or next to it, with + and ~ combinators) matches the argument. The card itself is styled, not the image. Examples: form:has(:invalid), label:has(+ input:checked). Attributes are selected with [attr].