The `:focus-within` Pseudo Class


Today I came across the a new CSS pseudo class that will be very handy for web developers who are styling focus states.

The :focus-within pseudo class becomes active when an element itself has focus or if any of its descendants does.

Take for example the following HTML code:

<div class="container" tabindex="0">
  <label for="text">Enter text</label>
  <input id="text" type="text" />

and the following CSS:

.container:focus-within {

Read the entire article at the source link…

#codango #developer #development #coder #coding

We're happy to share this resource that we found. The content displayed on this page is property of it's original author and/or their organization.


Leave a Reply

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