有CSS規則input
作爲我如何設置CSS規則的輸入,除了一個類型
input {
background:#FFFFFF
}
input:hover {
background:#BBBBBB
}
我想這種風格適用於所有input
元素,除了一個(例如,type="submit"
)。
如何從CSS樣式中排除一種輸入類型?
有CSS規則input
作爲我如何設置CSS規則的輸入,除了一個類型
input {
background:#FFFFFF
}
input:hover {
background:#BBBBBB
}
我想這種風格適用於所有input
元素,除了一個(例如,type="submit"
)。
如何從CSS樣式中排除一種輸入類型?
您可以使用:not()
選擇。
input:not([type='submit']):hover {
/* rules here */
}
你可以只覆蓋一般輸入外地風格,配有新的風格提交輸入字段。檢查出來:http://jsfiddle.net/dpYRX/2/
input {
background:#FFFFFF
}
input:hover {
background:#BBBBBB
}
input[type="submit"] {
background: #ff0000;
}
input[type="submit"]:hover {
background: #cdcdcd;
}
啊,他更快。 ;) – kleinfreund
我知道'not',但是我怎麼用':hover'來使用它? – Googlebot
只需在最後附上它,例如'輸入:不是([type = submit]):hover {}' – Adrift