1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Why Won't My Image Display As The Background On My Blog?

Discussion in 'CSS' started by bad_bob00, Nov 7, 2008.

  1. #1
    Hi,

    My blog has a background colour currently, but I've tried adding an image instead but it doesn't seem to work.

    I've uploaded the specific images to the /images folder on my web hosting directory, and this is the line of code from my CSS file:

    background: #ffffff url(images/footy4.jpg);

    (the file I uploaded is called footy4.jpg).

    Any idea why the image isn't displaying? The background displays the white background colour (and if I change the hex colour the background colour does change) but why wouldn't the background image also change?



    Thanks for any help
     
    bad_bob00, Nov 7, 2008 IP
  2. mjewel

    mjewel Prominent Member

    Messages:
    6,693
    Likes Received:
    514
    Best Answers:
    0
    Trophy Points:
    310
    #2
    Hard to say without knowing the url of the blog and where the css file is, but try
    background: #ffffff url (../images/footy4.jpg);
     
    mjewel, Nov 7, 2008 IP
  3. vlad230

    vlad230 Active Member

    Messages:
    544
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    95
    #3
    Check the path to the .css file first and make sure that the blog page is pointing to the correct .css file.

    If you want to see only the background image do this:
    
    background-image: url(/images/footy4.jpg); 
    background-repeat:no-repeat;
    
    Code (markup):
    I guess you don't want to make the image repeat itself... if you do you can change the "no-repeat" to "repeat-x" to repeat horizontally or "repeat-y" to repeat vertically or "repeat" to repeat the image vertically and horizontally.


    If you want to have the image in the background and when the content of your page extends beyond the surface of your bg image you could do a color for the background:

    
    background-color: #ffffff; 
    background-image:url(/images/footy4.jpg); 
    background-repeat: no-repeat;
    
    Code (markup):
    Cheers ;) ,
    Vlad
     
    vlad230, Nov 8, 2008 IP
    bad_bob00 likes this.
  4. wd_2k6

    wd_2k6 Peon

    Messages:
    1,740
    Likes Received:
    54
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Yep it's sure to be a problem with the link to the picture.
    Shouldn't (images/footy4.jpg) be (/images/footy4.jpg)
    And also this is assuming it's in that directory, could be as mjewel suggested or if it's in your parent directory could even be ../../images/footy4.jpg as wordpress blogs are two directories up sometimes.
     
    wd_2k6, Nov 8, 2008 IP
    bad_bob00 likes this.
  5. skateme

    skateme Peon

    Messages:
    162
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #5
    There might be a chance that your page content might be hiding your bg image by accident. Do you have your image in a set place, like 50% from top, 50% from left or something like that?
     
    skateme, Nov 8, 2008 IP
  6. justinlorder

    justinlorder Peon

    Messages:
    4,160
    Likes Received:
    61
    Best Answers:
    0
    Trophy Points:
    0
    #6
    I suggest you check the relative path of css and image files .
     
    justinlorder, Nov 9, 2008 IP
  7. bad_bob00

    bad_bob00 Active Member

    Messages:
    3,472
    Likes Received:
    56
    Best Answers:
    0
    Trophy Points:
    90
    #7
    I've fixed this now, thanks - I just had to add an / infront of the images directory link.


    Got another question now - is there a way to "fix" the background, so that is stretched to fill up the screen, and so that when you scroll down on the site, the background image is static, so that there isn't any white space?


    You can see what its like at the moment at http://footyblog.net/ (just scroll down a little and you see white space). I would just fill the white space with a colour but I don't think it will look right.


    Thanks for any more help
     
    bad_bob00, Nov 9, 2008 IP
  8. skateme

    skateme Peon

    Messages:
    162
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #8
    skateme, Nov 10, 2008 IP
    bad_bob00 likes this.
  9. bad_bob00

    bad_bob00 Active Member

    Messages:
    3,472
    Likes Received:
    56
    Best Answers:
    0
    Trophy Points:
    90
    #9
    Thanks guys, I'm not too sure if that would work very well on my blog though.

    If you go to the site at http://www.footyblog.net/ could anyone recommend what I should do regarding the background image? I can't just repeat it vertically because it won't blend properly...



    Thanks for any more help
     
    bad_bob00, Nov 10, 2008 IP
  10. wd_2k6

    wd_2k6 Peon

    Messages:
    1,740
    Likes Received:
    54
    Best Answers:
    0
    Trophy Points:
    0
    #10
    Hi,

    add this to your body {

    background-attachment: fixed;
     
    wd_2k6, Nov 10, 2008 IP