Here, the div.add-user
contains the form for registration. I wanted to apply styles to div.add-user
when the input is either :focus
or :valid
, but I failed to use input:focus + .add-user
. I tried to google the problem, but it seems like there is no solution for that. Is that even possible in CSS or should I use JS instead?
<div class="add-user">
<form id="add-user" action="/" method="post" autocomplete="off">
<div>
<input type="text" name="input-name" id="input-name" required>
...
</div>
</form>
</div>