Grow your CSS skills. Land your dream job.

using multiple :not selectors not working

  • # March 6, 2013 at 1:17 pm

    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?

    # March 6, 2013 at 1:49 pm

    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.

    # March 6, 2013 at 3:07 pm

    Thanks Merri it worked perfectly.

    # April 17, 2013 at 9:10 am

    Brilliant! Just what i needed :)

    # April 17, 2013 at 9:58 am

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

    This is going to be slow. :)

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".