Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 5 of 5
  1. #1
    Member
    Join Date
    Feb 2005
    Location
    Portland, Oregon
    Posts
    93
    Member #
    8959
    I have validated my CSS document, now I wonder...

    When applying 'color:' in CSS document under any named class, why does the 'background-color:' have to be in as well even though that you dont quite need the use of it?

    -ardia

  2.  

  3. #2
    Senior Member Fallout's Avatar
    Join Date
    Aug 2003
    Location
    Richmond, Virginia
    Posts
    543
    Member #
    2748
    It doesn't as far as I know... ?

    Code:
    h2 { color: #fff; }
    That will validate just fine.

  4. #3
    Senior Member Rince's Avatar
    Join Date
    Nov 2004
    Posts
    183
    Member #
    8318
    It's a recommendation rather than a requirement. Let's take for example this code:

    <body style="background-color:#FFFFFF; color:#000000;">
    <div style="background-image:url('black_coloured.gif');">
    <p style="color:#FFFFFF;>Text</p>
    </div>
    </body>

    Technically it's fine, but what would happen if the background image failed to load? Hence the recomendation that you put both forground and background colours in to any tag at the same time.

  5. #4
    Member
    Join Date
    Feb 2005
    Location
    Portland, Oregon
    Posts
    93
    Member #
    8959
    fallout, i was just wondering why we have to have both color and background-color in each to come out with a clean css, not in the fact of how to develop. thanks though.

    ahh rince, now i get it, just in case if one or other fails to load. this is just so bizarre, having to add both each times.

  6. #5
    Senior Member Rince's Avatar
    Join Date
    Nov 2004
    Posts
    183
    Member #
    8318
    this is just so bizarre, having to add both each times.
    You don't have to put both in each time. It's simply advisable to do so. Your CSS is still valid even if you don't.


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 04:57 PM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com