Today I learned that there exists a CSS pseudo-class called :focus-within which we can use to match an element if the element itself or any of its descendants are matched by :focus
.
It is very helpful in cases when you want to highlight a container which also have few child elements and you want to keep it highlighted even if any of child elements is currently in focus.
for more details and syntax, please check MDN.
The post Today I learned :focus-within appeared first on Rajesh Dhiman.
Top comments (0)