I\'m attempting to add a drop down to a page that already has a global \"select\" style. Is there a way to tell the new select list to ignore the global style? There\'s ab
What I usually do in this situation is add a unique class to the new element; in this case something like this will work:
and then in the stylesheet, find the global rule and add a :not() pseudoclass to differentiate:
select:not(.i-am-unique) {
/* global rules */
}
select.i-am-unique {
/* unique rules */
}
This requires minimal code updates, with only 1 class added in your HTML markup, one CSS selector tweaked, and 1 new declaration block for the unique element. Here is an example.
In addition, :not() is supported by a wide swath of browsers, even IE9+ and Safari 3.2+.