css - Overriding :visited overrides :link :hover :active -


please consider these styles:

a:link { color: blue } a:visited { color: red } a:hover { color: green } a:active { color: black } #special:link { color: pink } 

and markup:

<a href="#">normal link</a> <a href="#" id="special">special link</a> 

i expect "special" link pink while keeping other colors. however, pink replaces other colors.

why happening? how fix it? thank you.

i believe has css priority order.

because #special id, dwarfs element-level style applied. (this can proven in firefox firebug/chrome inspector , how inherited style sheets over-written id's style).

though, considering there no "present style" applied :active, :visited, etc. stand reason these styles still un-affected. yet, making following change hover seems kick in gear:

a:hover { color: green !important; } 

Comments

Popular posts from this blog

python - Scipy curvefit RuntimeError:Optimal parameters not found: Number of calls to function has reached maxfev = 1000 -

c# - How to add a new treeview at the selected node? -

java - netbeans "Please wait - classpath scanning in progress..." -