How to set CSS rules for input, except one type

前端 未结 3 1756
慢半拍i
慢半拍i 2021-01-11 22:05

I have CSS rules for input as

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

I want to apply this style to al

3条回答
  •  生来不讨喜
    2021-01-11 22:32

    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/

提交回复
热议问题