Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set CSS rules for input, except one type

I have CSS rules for input as

input {
background:#FFFFFF
}
input:hover {
background:#BBBBBB
}

I want to apply this style to all input elements, except one (e.g., type="submit").

How can I exclude one input type from a CSS style?

like image 524
Googlebot Avatar asked Jun 04 '13 20:06

Googlebot


1 Answers

You can use the :not() pseudo-class and an attribute selector, e.g.

input:not([type=submit]) {
    background: slategray;
}

Keep in mind there is no support for IE 8 and below.

http://jsfiddle.net/qpxYb/1/

like image 193
Adrift Avatar answered Oct 04 '22 17:10

Adrift