Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

cannot override webkit-any-link

Tags:

html

browser

css

a:-webkit-any-link {
    color: -webkit-link;
    text-decoration: underline;
    cursor: auto;
}

I can't override this css. I tried this post Blue lines under links on my site even though I've disabled all related CSS? I tried a lot. Still its not working. I don't want to modify each and every machine to change the user agent stylesheet. Please help.

like image 983
dev Avatar asked Feb 09 '16 23:02

dev


People also ask

What is a Webkit any link?

The :any-link CSS pseudo-class selector represents an element that acts as the source anchor of a hyperlink, independent of whether it has been visited. In other words, it matches every <a> or <area> element that has an href attribute. Thus, it matches all elements that match :link or :visited .

What color is Webkit link?

color: -webkit-link usually the color of HTML <a> is blue.


2 Answers

if you are saying that the styling

a:-webkit-any-link {
    color: -webkit-link;
    text-decoration: underline;
    cursor: auto;
}

is being set automatically somehow and you want to override it, start by simply setting anchor styling in your CSS:

a, a:link, a:visited, a:focus, a:hover, a:active{
  color:olive;
  text-decoration:none; 
  cursor: crosshair;
}

If this doesn't work for some reason, add additional selectors to increase the specificity of your rule, eg

body a{
   ...
}  

if this still doesn't work, use the dreaded !important

color:olive !important;

see this live:https://jsfiddle.net/panchroma/z7mkvbeu/

Good luck!

like image 130
David Taiaroa Avatar answered Oct 12 '22 22:10

David Taiaroa


The specificity David has warned you about is key to overriding rules, when all code is right. Without seeing your code, I cannot know if this applies to you, but to other coders to land here: please double check your rule. It is very likely that you have a typo on your rule, causing it not to be recognized and the default to be applied.

like image 25
isacvale Avatar answered Oct 12 '22 22:10

isacvale