2

I have a strange bug that only occurs on Chrome - visited links ignore the color attribute and turn black. The chrome inspector shows the computed color as "white", even though it is clearly black.

This is NOT caused by :visited, as I'm using the same text color, whether it is visited or not.

Here's a minimal fiddle:
You need to visit wikipedia for the bug to appear.

<a href="https://www.wikipedia.org/#">This text should be white</a>
<a href="https://www.wikipedia.org/">This text should also be white, but isn't</a>

Now, I know this is in part caused by "all: initial", but I need to use this to keep a consistent style in my webextension, since websites override random CSS properties.

Manuel Abascal
  • 5,616
  • 5
  • 35
  • 68
  • 2
    Possible duplicate of [Why doesn't this a:visited css style work?](https://stackoverflow.com/questions/8331688/why-doesnt-this-avisited-css-style-work) – Heretic Monkey Oct 09 '19 at 16:06
  • Please include all relevant code in the question itself, not just on an external site. You can use [Stack Snippets](https://meta.stackoverflow.com/q/358992/215552) to do so. – Heretic Monkey Oct 09 '19 at 16:07
  • Works fine for me, the text is white. Maybe include a screenshot of what you see with your inspector? – skyline3000 Oct 09 '19 at 16:10

1 Answers1

2

If you're having issues with the visited color being overwritten by the browser defaults, are you able to instead set all to unset?

#popup {
  all: initial;
}

#popup * {
  all: unset;
  display: block;
}

After looking around, not 100% sure why the browser color was overriding the visited anchor, even testing #popup * {color: initial;} rule worked, so I'm not sure what underlying mechanism is changing the text color. But looking over at the answer provided here https://stackoverflow.com/a/15903168/1440950 using unset clears the values as desired

Ertyguy
  • 666
  • 4
  • 13