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 6 of 6
  1. #1
    Senior Member mikeycorn's Avatar
    Join Date
    Mar 2003
    Posts
    272
    Member #
    891
    Code:
    body {
    	background-color: #ACC9E8;
    }
    It works just fine inline, but when I tried to move it to a linked style sheet, the background turns white. (All the rest of the css moved over just fine.)
    ~ mikeycorn
    With over 72,000 questions worth of user submitted quizzes, it's the world's most popular quiz creation software:
    PEST - The Personal Exam Self-Tester

  2.  

  3. #2
    WDF Staff mlseim's Avatar
    Join Date
    Apr 2004
    Location
    Cottage Grove, Minnesota
    Posts
    7,717
    Member #
    5580
    Liked
    718 times
    This happens because when you had it inline, the style sheet was loaded first,
    and then it got to your inline body style and executed that. It processes the
    CSS in order of their appearance ... the last styles defined over-rides the previous.

    Now, you probably put body{background-color:#acc9e8;} BEFORE the rest
    of the CSS. If you moved it to the bottom of your CSS file, it would probably work.

    What you're doing is fine, but I think you have some other <div>s with background
    colors defined. Define all other divs with: background-color:transparent;

    Finally, if all fails, show us the actual URL so we can see it.


  4. #3
    Senior Member mikeycorn's Avatar
    Join Date
    Mar 2003
    Posts
    272
    Member #
    891
    Wow, thanks, placing it last fixed the background color of the page, but now I lost my formatting on the h1

    Perhaps I can post my entire style sheet:

    Code:
    @charset "utf-8";
    /* CSS Document */
    <style type="text/css">
    
    .h1 {
    	font-family: Georgia, "Times New Roman", Times, serif;
    	font-weight: bold;
    	font-size: 18px;
    	text-align: center;
    	color: #CC3232;
    }
    .h2 {
    	font-family: Georgia, "Times New Roman", Times, serif;
    	font-size: 14px;
    	font-weight: bold;
    	font-style: italic;
    	text-align: center;
    	color: #CC3232;
    }
    .form_links {
    	color: #184376;
    	font-size: 12px;
    	font-weight: bold;
    	text-align: right;
    }
    .form_links a {
    	color: #0000FF;
    	text-decoration: none;
    }
    .form_links a:hover {color: #FFFFFF}
    .main {
    	font-size: 14px;
    	font-family: Arial, Helvetica, sans-serif;
    	font-weight: bold;
    	font-style: normal;
    	text-align: justify;
    	color: #7F7F7F;	
    }
    .main_centered {
    	font-size: 14px;
    	font-family: Arial, Helvetica, sans-serif;
    	font-weight: bold;
    	text-align: center;
    	color: #7F7F7F;	
    }
    .main_centered a {
    	text-decoration: none;
    	color: #0000FF;	
    }
    .main_centered a:hover {
    	text-decoration: none;
    	color:#CC3232;	
    }
    .footer {
    	font-family: "Courier New", Courier, monospace;
    	color: #184376;
    	font-size: 14px;
    	text-align: center;
    }
    body {
    	background-color: #ACC9E8;
    }
    The h2 also lost it's white background color (not specified, but no longer defaulting to white) that should be easy enough to fix, but it feels like I'm going about things the wrong way. Can you look at the style sheet and see where I might be making my cascades a little . . . convoluted?
    ~ mikeycorn
    With over 72,000 questions worth of user submitted quizzes, it's the world's most popular quiz creation software:
    PEST - The Personal Exam Self-Tester

  5. #4
    WDF Staff mlseim's Avatar
    Join Date
    Apr 2004
    Location
    Cottage Grove, Minnesota
    Posts
    7,717
    Member #
    5580
    Liked
    718 times
    I think you should keep body{..} first and then specify the
    background-color for all of the other CSS tags.

    .h1 {
    background-color: #efefef;
    font-family: Georgia, "Times New Roman", Times, serif;
    font-weight: bold;
    font-size: 18px;
    text-align: center;
    color: #CC3232;
    }


  6. #5
    Junior Member ditch182's Avatar
    Join Date
    Aug 2008
    Location
    Cary, NC
    Posts
    26
    Member #
    17268
    Liked
    1 times
    You have to be careful about what order you set your css attributes. Sometimes, just moving something up or down a few lines will change the way it works.

  7. #6
    Senior Member aeroweb99's Avatar
    Join Date
    Feb 2008
    Location
    Port Huron, Michigan
    Posts
    1,037
    Member #
    16468
    Liked
    1 times
    The background color for your body should have no effect on the rest of your styles. White is not the default background color for h2, it is whatever the background color you specified in its containing element. So like mlseim said, you need to declare the bg color if you want it to be different than its containing element. Also,without seeing the markup, i'm not sure why you made those declarations with class?


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 10:07 PM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com