CSS Validation Warning

Discussion in 'CSS' started by crath, Jun 26, 2008.

  1. #1
    crath, Jun 26, 2008 IP
  2. Ulquiorra

    Ulquiorra Peon

    Messages:
    422
    Likes Received:
    14
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Ignore those things.

    W3 went mad and said that for every declaration of color, a declaration of background-color is required (and vice versa).

    They don't make your site CSS invalid.
     
    Ulquiorra, Jun 26, 2008 IP
  3. crath

    crath Well-Known Member

    Messages:
    661
    Likes Received:
    33
    Best Answers:
    0
    Trophy Points:
    100
    #3
    but i would not like any warnings either :p so i need to add background-color or just background: #color; whereever i have color defined?
     
    crath, Jun 27, 2008 IP
  4. blueparukia

    blueparukia Well-Known Member

    Messages:
    1,564
    Likes Received:
    71
    Best Answers:
    7
    Trophy Points:
    160
    #4
    Seriously, just screw it. Backwards. Twice.






    CSS validity, unlike HTML validity is almost pointless, since you have to hack for any browser these days.
     
    blueparukia, Jun 27, 2008 IP
  5. Ulquiorra

    Ulquiorra Peon

    Messages:
    422
    Likes Received:
    14
    Best Answers:
    0
    Trophy Points:
    0
    #5
    either would work
     
    Ulquiorra, Jun 27, 2008 IP
  6. kk5st

    kk5st Prominent Member

    Messages:
    3,497
    Likes Received:
    376
    Best Answers:
    29
    Trophy Points:
    335
    #6
    That's a warning, not an error. It's simply saying that you have created an opportunity for chaos. Background colors are inherited. If, for example, your css looks something like this:
    
    body {
      color: black;
      background-color: white;
      }
    
    a {
      background-image: url(some.png);
      color: white;
      }
    Code (markup):
    If the bg image is not displayed for whatever reason, you have white text on a white background.

    You don't have to use both color and background-color each time. The warning is to remind you to double check against the possibility of issues due to inheritance.

    Trust me, I have been asked to fix many sites that had "disappearing" text due to this.

    cheers,

    gary
     
    kk5st, Jun 27, 2008 IP
  7. crath

    crath Well-Known Member

    Messages:
    661
    Likes Received:
    33
    Best Answers:
    0
    Trophy Points:
    100
    #7
    alright well thanks guys :p
     
    crath, Jun 27, 2008 IP