Css input not required focused or disabled

I am trying to create a css rule to change the background color of an input if needed, but bot is disabled or has focus

I have this, but it doesn't explicitly work!

<input type="tel" class="form-control" placeholder="Phone" name="phone" value="" required>

      

and css:

input:not(disabled):not(focus):required {
    background-color: rgba(255,0,0,.10)
}

      

+3


source to share


1 answer


Use :

for pseudo selectors :disabled

and:focus



input:required:not(:disabled):not(:focus)

      

+5


source







All Articles