a:link {

color: rgb(255, 255, 255);

text-decoration: none;

font-weight: bold;

font-size: 20px;

}

a:visited {

color: white;

text-decoration: none;

font-weight: bold;

text-align: center;

}

Could anyone tell me why this is not working? Everything else on the CSS sheet is working apart from this part. On Chrome the links show up in blue (though not the default blue) and in safari it works for a majority of links, but not all. I am completely lost on why this is not working.

Dani AI

Generated

A couple of quick, practical notes drawn from this thread: when link color rules appear to “not work” it almost always comes down to the CSS cascade (another stylesheet or a more specific rule wins), the order your stylesheets are loaded, or browser privacy restrictions on :visited. The fastest way to see which rule is winning is to Inspect Element and look at the Styles / Computed panel — it shows the exact selector and file that set the final color.

If a third-party stylesheet (search widget, plugin, theme, etc.) is involved, the options are: make your selector more specific (or target a wrapper/class unique to your UI), change the load order so your stylesheet comes later, or namespace your link styles with a class to avoid collisions. Avoid reaching for !important except as a last resort. For how specificity and cascade determine which rule applies, see the CSS cascade and specificity guide: MDN — Cascade and specificity.

Also be aware that browsers restrict what can be styled for :visited links for privacy reasons. Color is typically allowed, but many other properties are not, and behavior can vary. See details here: MDN — :visited.

In future debugging, including the full CSS load order and a minimal HTML example helps others reproduce the issue quickly. Credit to for prompting the broader context and to for resolving it by isolating the links with a different class — that namespacing approach is the safest long-term fix. For quick inspection tips, use DevTools to trace the exact rule source: Chrome DevTools — Styles.

Recommended Answers

All 2 Replies

Can you explain the effect you want, and maybe post the rest of the css? Your text is white, the visited link is white, so the only change you want is for a visited link to be centered?

Hi, thanks for the help. The issue was it just wouldn't go white, but anything else I tried e.g. size, text-align worked. It turns out that it was being influenced by a separate css file used for my site search, so I resolved the issues by assigning it to a different class.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.