HTML/CSSQuestion 11 of 14
Pseudo-classes
Answer out loud or in your head first, then compare.
Answer
A pseudo-class selects an element based on its state or its position in the structure.
CSS
button:hover { background: #ddd; }
button:focus-visible { outline: 2px solid blue; }
input:checked { accent-color: blue; }
li:nth-child(odd) { background: #eee; }
button:disabled { opacity: .5; }Other examples: :first-child, :not(...), :has(...), :valid.
To be precise: a pseudo-element, e.g. ::before or ::first-line, targets part of an element or generated content. That's a different category.
Pitfall: I don't expose an important feature only through :hover — keyboard and phone users must be able to use it too.
How did it go? Be honest — “Not yet” puts the question on your review list.