如何设置输入的CSS规则,除了一种类型 [英] How to set CSS rules for input, except one type
本文介绍了如何设置输入的CSS规则,除了一种类型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有输入的CSS规则
为
input {
background:#FFFFFF
}
input:hover {
background:#BBBBBB
}
我想将此样式应用于所有输入
元素,除了一个(例如, type =
I want to apply this style to all input
elements, except one (e.g., type="submit"
).
如何从CSS样式中排除一个输入类型?
How can I exclude one input type from a CSS style?
推荐答案
您可以使用 :not()
伪类和属性选择器,例如
You can use the :not()
pseudo-class and an attribute selector, e.g.
input:not([type=submit]) {
background: slategray;
}
请记住,不支持IE 8及以下版本。
Keep in mind there is no support for IE 8 and below.
这篇关于如何设置输入的CSS规则,除了一种类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文