Pseudo-classes in CSS
State selectors: hover, focus, disabled, and the structural ones.
.button:hover {
background: #2a2f3a;
}
.button:focus-visible {
outline: 2px solid #7c5cff;
outline-offset: 2px;
}
.button:disabled {
cursor: not-allowed;
opacity: 0.5;
}
.step:not(:last-child) {
border-bottom: 1px solid #222;
}
How it works
:focus-visibleshows a ring for keyboard users only.:is()groups selectors without raising specificity.:not()excludes, and:first-childcounts position.
Keywords and builtins used here
backgroundbuttoncursoropacityoutlinepxstep
The run, in numbers
- Lines
- 17
- Characters to type
- 230
- Tokens
- 59
- Three-star pace
- 70 tpm
At the three-star pace of 70 tokens a minute, this run takes about 51 seconds.
Step 5 of 6 in Selectors, step 5 of 26 in Selectors & the box model.