Today I learned :focus-within

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 has 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.

Hey there, my name is Rajesh, and I'm a Javascript developer ( currently working with Vue and Nuxt) working full time at a job I love. I have been a full-stack developer for several years and have worked on complex backend and database stuff in the past. I am now more focused on the frontend, UI/UX and web accessibility. I am very new to writing content, but I want to write more so I can help students and budding developers start their dream careers.

Share

Leave a Reply

Your email address will not be published. Required fields are marked *

Post comment