Topic on Project:Support desk/Flow

Color of visited interwiki and external links

4
Summary by Ttwinic

Resolved by replacing

.mw-body-content a:link { color: #0000FF; } /* normal unvisited links */
.mw-body-content a:link:active { color: #FF0000; } /* active links */
.mw-body-content a:link.new { color: #FF0000; } /* new links */
.mw-body-content a:link.interwiki { color: #3366BB; } /* interwiki links */
.mw-body-content a:link.external { color: #3366BB; } /* external links */
.mw-body-content a.interwiki:visited { color: #3366BB; }
.mw-body-content a.external:visited { color: #3366BB; }

with

.mw-body-content a:visited { color: #0645AD !IMPORTANT; }
.mw-body-content a.new:link { color: #cc2200 !IMPORTANT; }
.mw-body-content a.new:visited { color: #a55858 !IMPORTANT; }
Ttwinic (talkcontribs)

Hey all. I want to make it so that my external links and interwiki links stay the same color regardless of whether they've been clicked on or not.

I've looked through Help:Link color and this old Support desk topic and came up with the following code to add to my MediaWiki:Common.css page. However, my visited links are still a different color. What am I missing?

.mw-body-content a:link { color: #0000FF; } /* normal unvisited links */
.mw-body-content a:link:active { color: #FF0000; } /* active links */
.mw-body-content a:link.new { color: #FF0000; } /* new links */
.mw-body-content a:link.interwiki { color: #3366BB; } /* interwiki links */
.mw-body-content a:link.external { color: #3366BB; } /* external links */
.mw-body-content a.interwiki:visited { color: #3366BB; }
.mw-body-content a.external:visited { color: #3366BB; }
AhmadF.Cheema (talkcontribs)

One messy but effective way that I have found to work for achieving this, would be:

a:visited { color: #0645AD !IMPORTANT; }
a.new:link { color: #cc2200 !IMPORTANT; }
a.new:visited { color: #a55858 !IMPORTANT; }

The above rules appear to be enough for visited interwiki links too.

Ttwinic (talkcontribs)

Cool! That helps, though I don't yet know enough about CSS to understand how. What's the purpose of the !IMPORTANT part?

AhmadF.Cheema (talkcontribs)

The !IMPORTANT (or !important) part forces the rule to override all other relevant rules. For example, at one place an object is defined in red colour, while at another place it is orange, the CSS rule with the !important will have a higher priority over all other colour definitions.

These should be used sparingly as they can cause much confusion in large projects.

Reply to "Color of visited interwiki and external links"