danarj danarj - 1 year ago 55
CSS Question

stop applying css selector for one element

I want to prevent this CSS selector from being applied to all elements in the page:

input {

This will make the text red for
s of every type, but I want to exclude one input from this without changing the selector or style of this CSS rule. The element should have the default style (how it is when you have no css on the page).

Answer Source

You can use the not selector. Since an input field should have a name, you could exclude it by using:

input:not([name="exludeme"]) { }

This method won't work in IE8 and earlier versions. To support ie7 and ie8 too, you could use the attribute selector. In this case you have to reset the field:

input[name="exludeme"] { /*add all your reset styles here*/ }
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download