2013-06-04 33 views

回答

21

您可以使用:not()僞類和一個屬性選擇器,例如,

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

請記住,不支持IE 8及以下版本。

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

+0

啊,他更快。 ;) – kleinfreund

+0

我知道'not',但是我怎麼用':hover'來使用它? – Googlebot

+1

只需在最後附上它,例如'輸入:不是([type = submit]):hover {}' – Adrift

2

您可以使用:not()選擇。

input:not([type='submit']):hover { 
/* rules here */ 
} 
1

你可以只覆蓋一般輸入外地風格,配有新的風格提交輸入字段。檢查出來:http://jsfiddle.net/dpYRX/2/

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

input[type="submit"] { 
    background: #ff0000; 
} 

input[type="submit"]:hover { 
    background: #cdcdcd; 
} 
相關問題