Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to let css selector exclude an element?

For example I have a css style like this :

    input.validation-passed {border: 1px solid #00CC00; color : #000;}

The javascript validation framework I use will inject every input tag with a class="validation-passed" .For the elements like <input type='text' /> ... , this is ok , but for <input type='button' /> , I want this is not applied , how should I do this ?

like image 599
Sawyer Avatar asked Mar 23 '10 02:03

Sawyer


People also ask

How do you exclude an element from a universal selector?

If you want to exclude root elements like html / body , you could select all elements within them. To exclude other elements, you could use the :not() pseudo-class to negate them. For instance, you could add an . excluded class to the elements.

How do you exclude an element?

Press TAB to highlight the element, and then click to select it. In the drawing area, click the icon ( ) to exclude the element, or right-click, and click Exclude. The element is excluded from the group instance, and hosted elements are rehosted as necessary.

How do I select all child elements except one in CSS?

To select all the children of an element except the last child, use :not and :last-child pseudo classes. Example 1: This example creates a navigation menu separated by right border except the last element. Example 2: This example creates a navigation menu and uses some CSS property except the last element.

Can you use wildcard in CSS selector?

Wildcard Selectors (*, ^ and $) in CSS for classesWildcard selector is used to select multiple elements simultaneously. It selects similar type of class name or attribute and use CSS property. * wildcard also known as containing wildcard.


1 Answers

.validation-passed:not(input[type="button"]) {color:red;}
like image 144
Knu Avatar answered Oct 12 '22 12:10

Knu