CSS Background color issues.


New member
Okay, so, I was working on validating a CSS file. I didn't write it, but I wanted to do what I could to rework everything necessary so the W3C validator reported no errors, and no warnings.

I ALMOST succeeded. But the last warning I have left, is this:

Line : 322 (Level : 1) You have no background-color with your color : a:visited

Now, it's a bit of a catch all. Every anchor that hasn't been handled elsewhere uses a specific font color. I guess it's a bit of a shortcut, but I can't blame the guy for doing it.

However, I did go in and say:

background-color : transparent;

Now, from what I've Googled, and from W3C Schools... that *should* be fine. "transparent" seems to be a valid option for a background/background color.

Yet the error remains.

If I assign it a real color, say, #fff, then it throws off all the parts of the page that have different-colored backgrounds. Do I have to go back in and find these spots, and specify a:visited for each of them? Do I live with the warning?
<P ID="signature">http://www.sloganizer.net/en/
background-color is not a required element. Perhaps there is an emtpy value there you missed, like planly background-color: ; or some glitch like that.

Care to post the code block of that?
<P ID="signature">_- | -_
</P><P ID="edit"><FONT class="small">Edited by MonsieurSirhan on 08/10/06 03:48 PM.</FONT></P>
The issue with this warning http://www.w3.org/Search/Mail/Public/search?type-index=www-validator-css&index-type=t&keywords=transparent&search=Searchhas been brought up before</a>. Ultimately, the validator is saying that transparent, while a valid value, is not a valid color (which is true, since it's an absence of color). This could lead to a very bad situation in which the anchored text is in front of a low contrast background. That's your warning: if this text gets placed over a background of the identical color, you will not see it.

I suppose, to be thorough, any class or id or element that has a background attribute should have a matching CSS parameter for any contained anchors. Yes, it's anal, but then you'd know that you'll never end up with "invisible" links. Also bear in mind that this is an automatic validator (which will be anal with its report) coded by the W3C (who get paid (or not paid, whatever) to be anal about standards compliance).

The global catch-all a:visited tag is lazy design, plain and simple. However, it's still very functional design. For a stylesheet that you didn't write that goes along with a web app that you didn't code, I'd say you've done more than enough. It's just a warning, afterall.
<P ID="signature">_______________________________________
That was some good info; thanks for that.

I guess, in the long run, it would be good for me to completely fix the CSS - just so I could prove to myself that I CAN fix a CSS file so it validates completely. ;) But at the same time, I'm very pleased to find out I'm not the only one complaining about this, ah, warning.
<P ID="signature">http://www.sloganizer.net/en/
> background-color is not a required element.

According to the auto-validator, if you have a 'color' element, you must also have a background-color or background element to match it. It displays fine in a webbrowser; but I wanted to make sure the validation services okayed everything.

That said, it DOES say the CSS file is valid - and a whopping ONE warning noted seems to suggest my work is done, as far as 'fixing' everything.
<P ID="signature">http://www.sloganizer.net/en/
Top Bottom