Modern CSS
:has()
:has() allows parent and relational styling without extra classes or JavaScript hooks.
.card:has(.error-message) {
border-color: red;
} .form-group:has(:focus-visible) {
outline: 2px solid currentColor;
} Architecture impact
- reduces JavaScript state hooks
- improves relational styling
- supports progressive enhancement
- reduces component coupling