SitePoint Sponsor

User Tag List

Results 1 to 9 of 9
  1. #1
    SitePoint Addict gl3nnx's Avatar
    Join Date
    May 2005
    Location
    at http://www.gl3nnx.net
    Posts
    343
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    CSS newbie question: background-color

    Do i need to include background-color in CSS when i use the color: ??? i dont my link tag to have a background color!

    Line : 13 (Level : 1) You have no background-color with your color : a:link.aheader
    Line : 14 (Level : 1) You have no background-color with your color : a:hover.aheader
    Line : 15 (Level : 1) You have no background-color with your color : a:visited.aheader
    Line : 16 (Level : 1) You have no background-color with your color : a:active.aheader


  2. #2
    CSS & JS/DOM Adept bronze trophy
    Join Date
    Mar 2005
    Location
    USA
    Posts
    5,482
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Those are just warnings. Feel free to ignore the ones about background-color on <a> elements.

    Some of the guys who run the CSS Validator feel the need to warn you when you do something that might cause accessibility problems.
    We miss you, Dan Schulz.
    Learn CSS. | X/HTML Validator | CSS validator
    Dynamic Site Solutions
    Code for Firefox, Chrome, Safari, & Opera, then add fixes for IE, not vice versa.

  3. #3
    SitePoint Wizard bronze trophy cydewaze's Avatar
    Join Date
    Jan 2006
    Location
    Merry Land, USA
    Posts
    1,096
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    I've mentioned this before, but I've eliminated this warning by using background-color: inherit;

    But like Kravvitz said, it's not really necessary to do.

  4. #4
    SitePoint Addict gl3nnx's Avatar
    Join Date
    May 2005
    Location
    at http://www.gl3nnx.net
    Posts
    343
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thank u guys, , thanks cydewze.. ok i will use the background inherit... just want my CSS to be a valid one.

  5. #5
    SitePoint Addict greg76's Avatar
    Join Date
    Aug 2004
    Location
    Poland
    Posts
    273
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    inherit

    Aloha,

    I have just finished applying background-color: inherit; to my css file in order to remove these warnings (it bugs me, really).

    Every time I did a change to any element I tested that change in my browser and then using css validator. Every time list of warnings was shorter and site worked properly. Untill... I opened it in Opera. There, everything was messed up.

    So I'd better get used to warnings and keep my site available and nice-looking for all browsers ...


    cheers!
    G.

  6. #6
    SitePoint Wizard bronze trophy cydewaze's Avatar
    Join Date
    Jan 2006
    Location
    Merry Land, USA
    Posts
    1,096
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    That's weird, because I thought that "inherit" was assumed anyway, in the absense of a specific color.

  7. #7
    SitePoint Member
    Join Date
    Mar 2006
    Posts
    14
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I've been using "background-color : transparent;" to keep it from assigning it a background color. Inherit will take on the background of the parent. If you don't want one assigned, use transparent.

  8. #8
    The CSS Clinic is open silver trophybronze trophy
    Paul O'B's Avatar
    Join Date
    Jan 2003
    Location
    Hampshire UK
    Posts
    40,367
    Mentioned
    180 Post(s)
    Tagged
    6 Thread(s)
    "background-color : transparent;"
    That won't get rid of the warnings anymore (it used to until they updated the validator). You need to set a specific background color (or background:inherit)

    However they are only warnings and if you are happy that someone isn't going to get white text on a white background then it's your choice. (But of course a user stylesheet may have set the text to a certain colour and if you happen to set the background to the same color without specifying the the text color then the text becomes invisible.)

    The default for background-color is transparent not inherit.

  9. #9
    SitePoint Wizard bronze trophy cydewaze's Avatar
    Join Date
    Jan 2006
    Location
    Merry Land, USA
    Posts
    1,096
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Paul O'B
    The default for background-color is transparent not inherit.
    Thanks for that.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •