html - How do I unhover on a link using CSS/JavaScript? -


i'm using css set links red when hover on them. clicking on them open new tab, links remain hovered(red). possible unhover on button click? looks bad, on mobile.

css: a:hover { color: red; }  html: <a href="www.example.com" target="_blank">open site in new tab, remains red</a> 

the state of link i.e. a tag focus after have clicked on , have not clicked anywhere else. so, want change style :focus state of anchor tag.

css: a:hover { color: red; } a, a:focus {   color: green; /* or whichever default color */ }  /* can add same or different style a:visited state, applies anchor tags have been visited */  html: <a href="www.example.com" target="_blank">open site in new tab, remains red</a> 

Comments

Popular posts from this blog

java - Static nested class instance -

c# - Bluetooth LE CanUpdate Characteristic property -

JavaScript - Replace variable from string in all occurrences -