a:visited selector ignores text-decoration: line-through style




CSS Parsing and Computation
7 years ago
5 years ago


(Reporter: Shane Beasley, Unassigned)


Firefox Tracking Flags

(Not tracked)




7 years ago
User-Agent:       Mozilla/5.0 (Windows NT 5.1; rv:2.0) Gecko/20100101 Firefox/4.0
Build Identifier: 4.0

The a:visited selector ignores style text-decoration: line-through but not other styles (e.g. color: gray). Other selectors such as a.className or a:hover work fine.

Reproducible: Always

Steps to Reproduce:
Save this HTML file, then click on one of the "#" links to "visit" that URL:

a, span {
    font-weight: bold;
    color: inherit;
    cursor: default;
    text-decoration: underline;

a:visited, a.visited, span.visited {
    font-weight: normal;
    text-decoration: line-through;
    color: gray;

a:hover, span:hover {
    text-decoration: line-through;
<a href="about:blank">a(normal)</a>
<a href="#">a:visited</a>
<a href="about:blank" class="visited">a.visited</a>
<a href="#" class="visited">a.visited:visited</a>
<span class="visited">span-visited</span>
Actual Results:  
*.visited and a:visited are gray, and *.visited is decorated with line-through, but a:visited is decorated with underline.

Expected Results:  
Both *.visited and :visited should be decorated with line-through.

To rule out any interference from extensions, etc., I ran Firefox with an empty profile in my user temp folder like so:

"%PROGRAMFILES%\Mozilla Firefox\firefox.exe" -no-remote -profile "%temp%\fxpfx"

The problem persists.

Comment 1

7 years ago
That's intended, see bug 147777
Whiteboard: dupme
Indeed.  See also http://dbaron.org/mozilla/visited-privacy
Blocks: 147777
Last Resolved: 7 years ago
Resolution: --- → INVALID
Whiteboard: dupme

Comment 3

7 years ago
Okay, so I've seen three documents:


They suggest that the CSS below, applied to comment 0, should give me visited links with backgrounds and borders, but I don't. Is that intentional?

a, span {
    border-bottom: 1px solid transparent;
    outline: 1px solid transparent;

a:visited, a.visited, span.visited {
    color: purple !important;
    background-color: yellow !important;
    border-bottom-color: purple !important;
    outline-color: purple !important;

[Slightly off-topic: Is there any dispensation for disabling this feature globally or on a per-site basis (e.g. with Greasemonkey)?]

Comment 4

7 years ago
Oh, and also this link, which seems to be the official documentation on this feature:

The behavior on that testcase is expected, yes.  You can change _which_ color the border, outline, and background are, but you can't go from transparent to a color.  This is actually documented in the document you link to in comment 4:

  In addition, even for the properties you can set for visited links, you won't
  be able to change the transparency between unvisited and visited links

If you set background, border, and outline colors in that first rule, then the second rule will take effect.

> Is there any dispensation for disabling this feature

There is not, no...

Comment 6

7 years ago

I saw the part about rgba/hsla but somehow skipped over "transparent." Oops.

By the way, I filed this in regards a client-side global style sheet that I apply to all sites because I usually find it difficult to distinguish between :link and :visited colors, hence why I'm upset that I'm left to distinguish between :link and :visited colors. :/

I'm disappointed, but not surprised. Anyway, thanks for putting up with me. :)
David, is it worth adding some sort of accessibility workaround for this?

Comment 8

7 years ago
Oh, dear, what have I done... Although accessibility is definitely a good thing, I'm not sight-impaired myself (at least, I don't think I am). I just find that when I'm looking at a wall of text and graphics like a Google News or Reddit, it's easier to review unseen content if those links are markedly different from the others. <g>

Incidentally, I cobbled together a Greasemonkey script that colors links that I've clicked on the current page (with the middle button, i.e. in a new tab). Seems like that sort of thing will do for now, for my purposes.
Well, "accessibility" doesn't have to be sight-impairment issue.  Just "anything that makes it hard for someone to make sense of a page".  Which I think your use case certainly falls under, and I doubt you're the only one.  The question is whether we can meet it without leaking the contents of your history to random sites.


6 years ago
Duplicate of this bug: 680318


5 years ago
Duplicate of this bug: 768772


5 years ago
Duplicate of this bug: 768773
You need to log in before you can comment on or make changes to this bug.