jquery ui - Priority of one css attribute value over another -


for button have 3 possible classes: "state-normal", "state-focus" , "state-hover". have same attributes (background, border, ...), different values attributes.
if button gets "state-focus", not want remove class "state-normal".
if button "state-focus" , gets "state-hover", not want remove class "state-focus".
in browser language specification can give "quality"/priority language:

"accept-language: da, en-gb;q=0.8, en;q=0.7" 

it great same in css:

.state-normal { background-color: #aaaaaa;q=0.5 } .state-focus  { background-color: #bbbbbb;q=0.7 } .state-hover  { background-color: #eeeeee;q=0.9 } 

i know there nothing in css.

but, know in jquery ui have kind of this, because don't remove "ui-state-default" when assign "ui-state-focus" element. how it?

is there way implement trick (without !important).

thanks alot in advance

you can using css.

.state-normal { background-color: #aaaaaa;q=0.5 } .state-normal.state-focus  { background-color: #bbbbbb;q=0.7 } .state-focus.state-hover  { background-color: #eeeeee;q=0.9 } 

but implies classes mentioned in rule present, i.e. element have both classes present. element class state-focus not have background-color set per rule.

if want avoid that, can instead:

.state-normal { background-color: #aaaaaa;q=0.5 } .state-focus, .state-normal.state-focus  { background-color: #bbbbbb;q=0.7 } .state-hover, .state-focus.state-hover  { background-color: #eeeeee;q=0.9 } 

edit: per op's request

css specificity

css selectors - mdn

similar answer


Comments

Popular posts from this blog

php - Why I am getting the Error "Commands out of sync; you can't run this command now" -

linux - Does gcc have any options to add version info in ELF binary file? -

java - Are there any classes that implement javax.persistence.Parameter<T>? -