Applying CSS to input container on focus
I have a div with a input field and a button inside. I would like the button to be hidden until the user focuses on the input.
I have tried to use the :focus pseudo-class on the containing div as I thought it would be inherited upon focusing on the input however it did not work.
Here is my html
And here is the css I have already tried
In this case, you can use the adjacent sibling combinator,
As FelipeAls points out, though, you can’t click on the button if the focus is removed. You could therefore do something like this in addition: