+ Reply to Thread
Results 1 to 7 of 7

Thread: CSS Prob

  1. #1
    Twinkie is offline Banned Twinkie is an unknown quantity at this point
    Join Date
    Sep 2007
    Location
    Ft. Lauderdale, Florida
    Posts
    1,389

    CSS Prob

    Could someone please tell me why in this page, the background image of the error box does not show up?

    Small problems like this drive me nuts :'(

  2. #2
    Anna's Avatar
    Anna is offline I am just me Anna is a name known to allAnna is a name known to all
    Join Date
    Aug 2007
    Location
    Sweden
    Posts
    6,569

    Re: CSS Prob

    you specify the color after the image, the browser will use the parameter that comes last in the list and apply.

    What you have now:
    Code:
    #body div#statusbox_failure {
    	background-image: url("../images/icon_failure.png");
    	background-color: #FFFAF1;
    	border: 1px solid #D2A960;
    }
    Change to:
    Code:
    #body div#statusbox_failure {
    	background: #FFFAF1 url("../images/icon_failure.png");
    	border: 1px solid #D2A960;
    }
    Do you have trouble reaching your site?
    Check here first: News and Announcements


    Don't forget that x10hosting has an irc server as well. Come and join the fun
    server: irc.x10hosting.com, main channel: #x10hosting
    There's a lot helpful users there if need help building your site

  3. #3
    misson is offline x10 Spammer misson is a jewel in the rough
    Join Date
    Mar 2008
    Location
    Libertatia
    Posts
    2,506

    Re: CSS Prob

    Quote Originally Posted by LadyAnna View Post
    you specify the color after the image, the browser will use the parameter that comes last in the list and apply.
    That's only true if you set both using separate "background" properties:
    Code:
    #body div#statusbox_failure {
    	background: url("../images/icon_failure.png");
    	background: #FFFAF1;
    	border: 1px solid #D2A960;
    }
    If you use the "background-color" and "background-image" properties, or a single "background" property, the image will display in front of the color.

    The problem is you set "background-attachment" to "fixed", which fixes the image relative to the viewport (in other words, the BG won't scroll). Remove the "background-attachment" property and it shows up.

    By the way, you use a selector of "#body div#statusbox_success, div#statusbox_failure" in style.css when you probably want "#body div#statusbox_success, #body div#statusbox_failure".
    Be sure to read all pages linked in this post; they have further information that should prove useful. When asking for help, make sure you follow Eric Raymond's and Jon Skeet's guidelines for prompt, accurate responses. Please answer any questions I ask; they're not rhetorical (probably). Any posted code is intended as illustrative example, rather than a solution to your problem to be copied without alteration. Study it to learn how to write your own solution.
    Misson, not Mission.

  4. #4
    subsilver is offline x10Hosting Member subsilver is an unknown quantity at this point
    Join Date
    Jun 2009
    Posts
    5

    Re: CSS Prob

    I would do it like this:

    Code:
    #body div#statusbox_failure {
    background:#FFFAF1 url(../images/icon_failure.png) no-repeat 5px;
    border:1px solid #D2A960;
    }
    Cheers!
    Last edited by subsilver; 07-11-2009 at 09:20 AM.

  5. #5
    diabolo's Avatar
    diabolo is offline Community Advocate diabolo is on a distinguished road
    Join Date
    Nov 2007
    Location
    Jersey Shore
    Posts
    1,683

    Re: CSS Prob

    Code:
    #body div#statusbox_success, div#statusbox_failure {
      background-attachment:fixed;
      background-position:left center;
      background-repeat:no-repeat;
      color:#000000;
      font-family:Verdana,Geneva,sans-serif;
      font-size:13px;
      height:100%;
      line-height:normal;
      margin:10px 8px 13px;
      padding:20px 20px 20px 60px;
      vertical-align:middle;
    }
    change to
    Code:
    #body div#statusbox_success, div#statusbox_failure {
      background-position:left center;
      background-repeat:no-repeat;
      color:#000000;
      font-family:Verdana,Geneva,sans-serif;
      font-size:13px;
      height:100%;
      line-height:normal;
      margin:10px 8px 13px;
      padding:20px 20px 20px 60px;
      vertical-align:middle;
    }

    I don't know what that will mess up on your other pages, but it will fix the problem you are having now.

    o, and if you do not have it already get FF and install FireBug. That's how I debugged your problem.

  6. #6
    Twinkie is offline Banned Twinkie is an unknown quantity at this point
    Join Date
    Sep 2007
    Location
    Ft. Lauderdale, Florida
    Posts
    1,389

    Re: CSS Prob

    Thanks! I would not have figured that out myself

    Does that mean with the background attachment set to fixed, the image was fixed at left: 0; top: 50%; relative to the window rather than the element?
    Last edited by Twinkie; 07-11-2009 at 02:40 PM.

  7. #7
    misson is offline x10 Spammer misson is a jewel in the rough
    Join Date
    Mar 2008
    Location
    Libertatia
    Posts
    2,506

    Re: CSS Prob

    Quote Originally Posted by Twinkie View Post
    Thanks! I would not have figured that out myself
    You could have if you created a minimal test case or used a CSS debugger, such as Firebug, Firefox's DOM inspector or Safari 4's debugger. It's easiest to selectively disable style rules in Safari 4.

    Quote Originally Posted by Twinkie View Post
    Does that mean with the background attachment set to fixed, the image was fixed at left: 0; top: 50%; relative to the window rather than the element?
    Yes.
    Be sure to read all pages linked in this post; they have further information that should prove useful. When asking for help, make sure you follow Eric Raymond's and Jon Skeet's guidelines for prompt, accurate responses. Please answer any questions I ask; they're not rhetorical (probably). Any posted code is intended as illustrative example, rather than a solution to your problem to be copied without alteration. Study it to learn how to write your own solution.
    Misson, not Mission.

+ Reply to Thread

Similar Threads

  1. signup prob bcoz country
    By bongtongplong in forum Free Hosting
    Replies: 1
    Last Post: 12-11-2008, 09:44 PM
  2. time out prob
    By elserge82 in forum Free Hosting
    Replies: 5
    Last Post: 01-18-2006, 11:10 AM
  3. MySQL prob plz fix!
    By Mani5 in forum Free Hosting
    Replies: 2
    Last Post: 01-07-2006, 04:56 AM
  4. Time out prob
    By elserge82 in forum Free Hosting
    Replies: 6
    Last Post: 11-29-2005, 07:04 PM
  5. .tk prob
    By elserge82 in forum Tutorials
    Replies: 12
    Last Post: 11-10-2005, 05:53 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers