CSS Background problem

Discussion in 'CSS' started by zaboer, Apr 29, 2012.

  1. #1
    my background image in css doesnt work when i put it online :S

    i tried all kind of codes
    offline it only works with this
    body {
        font: normal .80em arial, sans-serif;
        color: #AAA;
        background-attachment: fixed;
        background-color: #222;
        background-image: url(file://///ZABOER-PC/Users/zaboer/Documents/zaboer/Images/sitebackground.png);
        background-repeat: no-repeat;
        background-position: center top;
    }
    Code (markup):
    [​IMG]

    online
    [​IMG]

    help!
     
    zaboer, Apr 29, 2012 IP
  2. j_o

    j_o Well-Known Member

    Messages:
    516
    Likes Received:
    2
    Best Answers:
    1
    Trophy Points:
    113
    #2
    I believe that the following line in your code is incorrect

     
    background-image: url(file://///ZABOER-PC/Users/zaboer/Documents/zaboer/Images/sitebackground.png);
    
    Code (markup):
    You need to put your relative server path in the that line. Right now it is looking for the image in a location that does not exist on your server.
     
    j_o, Apr 29, 2012 IP
  3. zaboer

    zaboer Peon

    Messages:
    7
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    problem fixed

    i just put my picture in the css folder than just wrote url(sitebackground.png) and it worked lol
    it didnt work when i did images/sitebackground.png

    dont need help anymore :D
     
    zaboer, Apr 29, 2012 IP
  4. j_o

    j_o Well-Known Member

    Messages:
    516
    Likes Received:
    2
    Best Answers:
    1
    Trophy Points:
    113
    #4
    That does work however if you are going to having a bunch of images I would suggest having an images folder.
    If your files are stored in the images folder and your css is in a folder called css then the code would be:

    
    background-image: url(../images/sitebackground.png);
    
    Code (markup):
     
    j_o, Apr 29, 2012 IP
  5. zaboer

    zaboer Peon

    Messages:
    7
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    ye i did that but it didnt work
    so i put that background image in css folder and changed the code then it worked :)
     
    zaboer, Apr 29, 2012 IP
  6. j_o

    j_o Well-Known Member

    Messages:
    516
    Likes Received:
    2
    Best Answers:
    1
    Trophy Points:
    113
    #6
    hmm that should work, but it will depend on your exact folder structure. you might need to add another ../ depending where the folders are.
     
    j_o, Apr 29, 2012 IP