CSS :target-within
The :target-within pseudo-class was proposed to match an element when it or a descendant is the URL fragment target. It is not broadly supported for production use.
Syntax
section:target-within {
outline: 0.2rem solid #2563eb;
}
Practical alternatives
section:target {
outline: 0.2rem solid #2563eb;
}
section:has(:target) {
outline: 0.2rem solid #2563eb;
}
Important note
Keep :target-within as a reference item, but avoid presenting it as a normal cross-browser technique.