Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I prevent a CSS style to be overwritten?

I'd like to apply a CSS to some linkbuttons on page load but one of them <a id="lb1">logoff</a> must keep its style, no hover nor other event must change its style.

The linkbuttons have no class and the css applied to all of them is done to tags, this way:

a
{
 //style
}

a:hover
{
  // style
}

Is it possible?

like image 803
anmarti Avatar asked Dec 19 '12 16:12

anmarti


1 Answers

No, you can't.

You can use more specific selectors (or even inline CSS with the style attribute) so that they are less likely to be overridden accidentally.

You can use the (eugh) sledgehammer of !important so they will only be overridden by another !important rule.

There is no way to prevent them being overridden though.

like image 75
Quentin Avatar answered Sep 20 '22 14:09

Quentin