Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 12 of 12
  1. #1
    New Coder
    Join Date
    Oct 2009
    Posts
    19
    Thanks
    12
    Thanked 0 Times in 0 Posts

    Problems setting background in css...

    Beginner in code here, having issues with setting a bkrnd in css.

    I think this should be a simple fix...
    what am I doing wrong?


    Code:
    @charset "UTF-8";
    /* CSS Document */
    
    <style type="text/css">
    
    
    body
    {
    background-image:url('BTSbkrnd.jpg');
    }
    
    #wrapper #nav {
    	background-color: #FDDAAC;
    	text-align: right;
    	width: 720px;
    	float: right;
    	z-index: 1;
    }
    #wrapper {
    	width: 800px;
      margin-left: auto ;
      margin-right: auto ;
    }
    #wrapper #header {
    	position: relative;
    	z-index: 8;
    	top: 75px;
    	left: 30px;
    	width: 320px;
    }
    #content {
    	background-color: #FBDBAC;
    	float: right;
    	width: 720px;
    	z-index: 1;
    }
    #leftbox {
    	float: left;
    	width: 230px;
    	text-align: left;
    	top: auto;
    	padding-top: 20px;
    	z-index: 1;
    	padding-left: 5px;
    }
    #copy {
    	font-family: Tahoma, Geneva, sans-serif;
    	font-size: 14px;
    	text-align: left;
    	float: right;
    	width: 455px;
    	font-weight: bold;
    	color: #210;
    	padding-right: 15px;
    	padding-left: 15px;
    	z-index: 4;
    }
    
    </style>

  • #2
    Master Coder Excavator's Avatar
    Join Date
    Dec 2006
    Location
    Alaska
    Posts
    9,675
    Thanks
    22
    Thanked 1,827 Times in 1,811 Posts
    Hello ptsiii,
    That code should load an image called BTSbkrnd.jpg from the same directory that your css file is in.
    Double check your path and filename.


    /edit/
    From a previous post of yours, the path to that image is actually /images/BTSbkrnd.jpg so you would use
    Code:
    body {
    	background-image: url(images/BTSbkrnd.jpg);
    }
    Last edited by Excavator; 11-15-2009 at 09:08 PM. Reason: corrected path
    Validate often DURING development - Use it like a splelchecker | Debug during Development |Write it for FireFox, ignore IE
    Use the right DocType | Validate your markup | Validate your CSS | Why validating is good | Why tables are bad

  • Users who have thanked Excavator for this post:

    ptsiii (11-15-2009)

  • #3
    New Coder
    Join Date
    Oct 2009
    Posts
    19
    Thanks
    12
    Thanked 0 Times in 0 Posts
    thats what i thought, doesn't seem to be working.

  • #4
    Master Coder Excavator's Avatar
    Join Date
    Dec 2006
    Location
    Alaska
    Posts
    9,675
    Thanks
    22
    Thanked 1,827 Times in 1,811 Posts
    Can you put up a link to the test site? I could check the path for you then.
    Validate often DURING development - Use it like a splelchecker | Debug during Development |Write it for FireFox, ignore IE
    Use the right DocType | Validate your markup | Validate your CSS | Why validating is good | Why tables are bad

  • Users who have thanked Excavator for this post:

    ptsiii (11-15-2009)

  • #5
    Master Coder Excavator's Avatar
    Join Date
    Dec 2006
    Location
    Alaska
    Posts
    9,675
    Thanks
    22
    Thanked 1,827 Times in 1,811 Posts
    In place of knowing where your index and image files are, this might work for you as a temporary fix -
    Code:
    body {
    	background-image: url(http://bootsandpants.com/bts/images/BTSbkrnd.jpg);
    }
    Validate often DURING development - Use it like a splelchecker | Debug during Development |Write it for FireFox, ignore IE
    Use the right DocType | Validate your markup | Validate your CSS | Why validating is good | Why tables are bad

  • Users who have thanked Excavator for this post:

    ptsiii (11-15-2009)

  • #6
    New Coder
    Join Date
    Oct 2009
    Posts
    19
    Thanks
    12
    Thanked 0 Times in 0 Posts
    i put the new site up on my test site.

    www.bootsandpants.com/bts



    I must say... this is making me feel like quite an ignoramus... but i guess its better than my last attempt....

  • #7
    Master Coder Excavator's Avatar
    Join Date
    Dec 2006
    Location
    Alaska
    Posts
    9,675
    Thanks
    22
    Thanked 1,827 Times in 1,811 Posts
    In bts.css
    Delete the lines highlighted in red -
    Code:
    @charset "UTF-8";
    /* CSS Document */
    
    <style type="text/css">
    
    
    body {
    	background-image: url('images/BTSbkrnd.jpg');
    }
    
    #wrapper #nav {
    	background-color: #FDDAAC;
    	text-align: right;
    	width: 720px;
    	float: right;
    	z-index: 1;
    }
    #wrapper {
    	width: 800px;
      margin-left: auto ;
      margin-right: auto ;
    }
    #wrapper #header {
    	position: relative;
    	z-index: 8;
    	top: 75px;
    	left: 30px;
    	width: 320px;
    }
    #content {
    	background-color: #FBDBAC;
    	float: right;
    	width: 720px;
    	z-index: 1;
    }
    #leftbox {
    	float: left;
    	width: 230px;
    	text-align: left;
    	top: auto;
    	padding-top: 20px;
    	z-index: 1;
    	padding-left: 5px;
    }
    #copy {
    	font-family: Tahoma, Geneva, sans-serif;
    	font-size: 14px;
    	text-align: left;
    	float: right;
    	width: 455px;
    	font-weight: bold;
    	color: #210;
    	padding-right: 15px;
    	padding-left: 15px;
    	z-index: 4;
    }
    
    </style>
    You need the style lines for CSS embedded in the head of your document. A linked CSS file like your using should ONLY have CSS in it.
    Validate often DURING development - Use it like a splelchecker | Debug during Development |Write it for FireFox, ignore IE
    Use the right DocType | Validate your markup | Validate your CSS | Why validating is good | Why tables are bad

  • Users who have thanked Excavator for this post:

    ptsiii (11-15-2009)

  • #8
    New Coder
    Join Date
    Oct 2009
    Posts
    19
    Thanks
    12
    Thanked 0 Times in 0 Posts
    i tried using the code you posted

    Code:
    body {
    	background-image: url(http://bootsandpants.com/bts/images/BTSbkrnd.jpg);
    }
    ... still doesn't work. Could it have something to do with the fact that its the only style on the style sheet that doesn't pertain to a div?

  • #9
    New Coder
    Join Date
    Oct 2009
    Posts
    19
    Thanks
    12
    Thanked 0 Times in 0 Posts
    you're my hero.

    worked like a charm.

  • #10
    New Coder
    Join Date
    Oct 2009
    Posts
    19
    Thanks
    12
    Thanked 0 Times in 0 Posts
    i read in your signature... what is validation? if it is as important as you say it is... i should probably read up.... have any useful links or suggestions on the matter?

  • #11
    Master Coder Excavator's Avatar
    Join Date
    Dec 2006
    Location
    Alaska
    Posts
    9,675
    Thanks
    22
    Thanked 1,827 Times in 1,811 Posts
    Quote Originally Posted by ptsiii View Post
    i read in your signature... what is validation? if it is as important as you say it is... i should probably read up.... have any useful links or suggestions on the matter?
    In my sig, look at the "why validating is good" link.
    Did you notice there is a validator for your markup and another for your CSS?
    Also the tagline, "use it like a spellchecker" is a good suggestion.
    Validate often DURING development - Use it like a splelchecker | Debug during Development |Write it for FireFox, ignore IE
    Use the right DocType | Validate your markup | Validate your CSS | Why validating is good | Why tables are bad

  • Users who have thanked Excavator for this post:

    ptsiii (11-15-2009)

  • #12
    Master Coder Excavator's Avatar
    Join Date
    Dec 2006
    Location
    Alaska
    Posts
    9,675
    Thanks
    22
    Thanked 1,827 Times in 1,811 Posts
    I've always liked this explanation - http://diveintomark.org/archives/200..._wont_help_you
    Validate often DURING development - Use it like a splelchecker | Debug during Development |Write it for FireFox, ignore IE
    Use the right DocType | Validate your markup | Validate your CSS | Why validating is good | Why tables are bad


  •  

    Posting Permissions

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