#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2003
    Posts
    65
    Rep Power
    12

    Question CSS: Is there a "no background color" option?


    W3C recommendation
    The W3C warns that if a foreground color is specified, a background color should also be specified. Not doing so doesn't result in an error when running the stylesheet(s) through the CSS Validator, but it does result in a warning.

    Browser conflict
    I want my web site to (both HTML and stylesheets) to be fully W3C-compliant (not even one error or warning). Following the above W3C recommendation does make my entire site fully W3C-compliant but it also makes my site look horrid in Netscape Communicator 4.7.x (at least on Windows 98).

    My Question
    Is there a way to set the foreground color of something and set the background color to "none" or "transparent", etc? If so, then how?

    Thanks in advance.
    Last edited by macskeeball; July 9th, 2003 at 04:31 PM.
  2. #2
  3. PHP & Java Error Master
    Devshed Beginner (1000 - 1499 posts)

    Join Date
    Jun 2003
    Location
    My Computer
    Posts
    1,219
    Rep Power
    0
    Yeap:
    Code:
    .code
    {
    font-family: Helvetica, sans-serif;
    color: white;
    font-size: 10pt;
    background-color: transparent;
    }
  4. #3
  5. mod_dev_shed
    Devshed Supreme Being (6500+ posts)

    Join Date
    Sep 2002
    Location
    Atlanta, GA
    Posts
    14,817
    Rep Power
    1100
    On a related note, if you specify the background-color of an element and want the text color to be that of the entire site, use something like this:
    Code:
    body
      {
      background-color: white;
      color: black;
      }
    table
      {
      background-color: yellow;
      color: inherit;
      }
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2003
    Posts
    65
    Rep Power
    12
    Good to hear. Thanks again!

IMN logo majestic logo threadwatch logo seochat tools logo