treehouse : what would you like to learn today?
Web Design Web Development iOS Development

[Solved] using multiple :not selectors not working

  • I am wondering how to do multiple :not selectors in my css.

    For example:

    textarea, input:not([type=button]), input:not([type=submit]), input:not([type=number]) {  color: red;}
    

    All of my input's will be colored red, but when I do

    textarea, input:not([type=button]) {color:red;}
    

    then the input type button will not be red, just like I wanted.

    Will I just have to create two separate styles with the same properties?

  • Probably needs you to think differently:

      input:not([type=button]):not([type=submit]):not([type=number])
    

    Didn't test and I haven't used :not like this, but initial thoughts tell me this might be the answer.

  • Thanks Merri it worked perfectly.

  • Brilliant! Just what i needed :)

  • input:not([type=button]):not([type=submit]):not([type=number])

    This is going to be slow. :)