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?
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.
not, but how can I use it with :hover?input:not([type=submit]):hover {}You may use the :not() selector.
input:not([type='submit']):hover {
/* rules here */
}
You can just overwrite the general input field style with a new style for submit input fields. Check it out: http://jsfiddle.net/dpYRX/2/
input {
background:#FFFFFF
}
input:hover {
background:#BBBBBB
}
input[type="submit"] {
background: #ff0000;
}
input[type="submit"]:hover {
background: #cdcdcd;
}