You have no color with your background-color - Valid CSS Error

Discussion in 'CSS' started by misohoni, May 20, 2006.

  1. #1
    The "You have no color with your background-color" seems to be my only failing, do you guys always define a colour even if it's not needed - surely this is a waste of kb's.
     
    misohoni, May 20, 2006 IP
  2. kk5st

    kk5st Prominent Member

    Messages:
    3,497
    Likes Received:
    376
    Best Answers:
    29
    Trophy Points:
    335
    #2
    That's not an error, that's a warning. The implication is that there exists the possibility of a conflict due to the background and foreground colors being the same or very nearly the same.

    It is generally good form to designate the other if you designate one. It's not required.

    A very simplistic example of the problems that can arise:
    
    a {
        background-color: blue;
        }
    
    a:visited {
        background-color: purple;
        }
    Code (markup):
    You might recall the default foreground colors in most browsers are blue and purple, respectively. The text would become invisible against its background.

    cheers,

    gary
     
    kk5st, May 21, 2006 IP
    misohoni likes this.
  3. Hombre

    Hombre Peon

    Messages:
    27
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Hi,

    As mentioned they are warnings only but you can use the color:inherit; attribute - rather than naming the hex - to clear them if they bother you.
     
    Hombre, May 21, 2006 IP