csscss-selectorsconditional-operator

CSS "and" and "or"


I need to exempt some input types from styling. I had something like:

.registration_form_right input:not([type="radio")
{
    //Nah.
}

But I want to exempt checkboxes, too.

I've tried:

.registration_form_right input:not([type="radio" && type="checkbox"])
.registration_form_right input:not([type="radio" && "checkbox"])
.registration_form_right input:not([type="radio") && .registration_form_right input:not(type="checkbox"])

How do I use &&? And I'll need to use || soon, and I think that usage will be same.


Solution

  • && works by stringing-together multiple selectors like-so:

    <div class="class1 class2"></div>
    
    div.class1.class2
    {
      /* foo */
    }
    

    Another example:

    <input type="radio" class="class1" />
    
    input[type="radio"].class1
    {
      /* foo */
    }
    

    || works by separating multiple selectors with commas like-so:

    <div class="class1"></div>
    <div class="class2"></div>
    
    div.class1,
    div.class2
    {
      /* foo */
    }