1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

CSS Validation Problem

Discussion in 'HTML, Graphics & Programming' started by phykell, 9 May 2006.

  1. phykell

    Mobster

    Joined: 18 Oct 2002

    Posts: 4,410

    I'm getting the following W3C CSS validation warning:

    "You have no background-color with your color"

    The problem is that it's for link text which may be on different backgrounds, one of which is a graduated image. I'd like the background of the text to be transparent so I don't really want to specify a background colour for it at all but I do want to specify the colour of the text so I do need to specify the color attribute. Unfortunately, that doesn't seem possible. Am I asking too much? Is this not an issue with W3C's CSS validation that it can't accept that link text may need to be placed over different backgrounds?

    I can't even set the following:

    background-color: transparent;

    While this is valid CSS (the default bg colour for an element is "transparent"), the validator still seems to demand a solid colour :confused:
     
    Last edited: 9 May 2006
  2. Beansprout

    Man of Honour

    Joined: 31 Jan 2004

    Posts: 16,326

    Location: Plymouth

    There's basically not much you can do, although there's a couple of sometimes-useful tips here :)
     
  3. phykell

    Mobster

    Joined: 18 Oct 2002

    Posts: 4,410

    Thanks for that, from the tips on there I used this:

    background: inherit;

    And why didn't I think of that myself? :o
     
  4. Augmented

    Soldato

    Joined: 18 Oct 2002

    Posts: 5,464

    Location: London Town

    Bear in mind that this is only a warning. The validator is just a script; it has no sense of context and does not analyse colour contrast, legibility and so on. Hence why it warns about the possibility of an issue being present in your CSS. You can ignore warnings for the most part.

    The extra bandwidth requirements for a completely clean mark-sheet are not worth the bother when the additional rules aren't actually providing any real-world benefit :).