SitePoint Sponsor

User Tag List

Results 1 to 6 of 6

Thread: Need help with background image

  1. #1
    SitePoint Member
    Join Date
    Mar 2012
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question Need help with background image

    I'm trying to learn web code using the Build Your Own Website book and have had no problems until I tried atatching background images to the sample website using the background: color url(backgrounds .jpg) link. I can do it with regular images..why can't I do it with background images? I'm thinking it may have to do with my browser, but i'm not sure and don't know how to fix that if that is the case.

    Help,please,someone

  2. #2
    It's all Geek to me silver trophybronze trophy
    SitePoint Award Recipient ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, Australia
    Posts
    20,308
    Mentioned
    225 Post(s)
    Tagged
    3 Thread(s)
    Hi obrien45. Welcome to the forums.

    I've moved your post to its own thread. Could you post the full background image code you are using? I assume that background: color url(backgrounds .jpg) is not the actual code you are using. But just for the record, you shouldn't have a space between the file name and the file extension. E.g. it should be backgrounds.jpg, not backgrounds .jpg.
    Facebook | Google+ | Twitter | Web Design Tips | Free Contact Form

    Try your hand at the new JavaScript Challenge!

    If you don't like getting your feet stuck in a bog, avoid Twitter BootsTrap.

  3. #3
    <title class="lol"> bronze trophy TehYoyo's Avatar
    Join Date
    Feb 2012
    Location
    Northeast Chicago Suburbs
    Posts
    802
    Mentioned
    18 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by obrien45 View Post
    I'm trying to learn web code using the Build Your Own Website book and have had no problems until I tried atatching background images to the sample website using the background: color url(backgrounds .jpg) link. I can do it with regular images..why can't I do it with background images? I'm thinking it may have to do with my browser, but i'm not sure and don't know how to fix that if that is the case.

    Help,please,someone
    I don't think it has anything to do with the browser.

    I recall that the Build Your Own Website book organized files into images, css, and javascript folders. If you have a css file linking to an image, the image has to be in the same folder...remember that. Also, check again your file name. If you're using a jpeg file, I find sometimes that it doesn't work because the file has a 4-character 'jpeg' extension rather than a 3-character 'jpg' extension. On Windows, right-click and select properties. Then, look for a file extension in parentheses.

    ~TehYoyo

  4. #4
    SitePoint Member
    Join Date
    Mar 2012
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    background images

    The full background mage code that i'm using is background: #7da5db url(backgrounds/nav-bg.jpg) no-repeat;

    I know it's probably I relitively simple image code, but for some reason my browser doesn't seem to make the required connection, ad i can't figure out why.

    I'm really new to this stuff.

  5. #5
    It's all Geek to me silver trophybronze trophy
    SitePoint Award Recipient ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, Australia
    Posts
    20,308
    Mentioned
    225 Post(s)
    Tagged
    3 Thread(s)
    It may be that you are not pointing the browser to the right location. Where is the image stored in relation to your style sheet? That is, what folder is the style sheet in, and what folder is the image in? At the moment, your style sheet is in a certain folder, and the link you've given it is to a folder called "backgrounds" within that folder. Is that where you "backgrounds" folder is?
    Facebook | Google+ | Twitter | Web Design Tips | Free Contact Form

    Try your hand at the new JavaScript Challenge!

    If you don't like getting your feet stuck in a bog, avoid Twitter BootsTrap.

  6. #6
    billycundiff{float:left;} silver trophybronze trophy RyanReese's Avatar
    Join Date
    Oct 2008
    Location
    Whiteford, Maryland, United States
    Posts
    13,564
    Mentioned
    5 Post(s)
    Tagged
    0 Thread(s)
    If at the root directory, you have a folder "backgrounds" you can easily modify your CSS above to..
    Code:
    background: #7da5db url(/backgrounds/nav-bg.jpg) no-repeat;


    If your backgrounds file IS INDEED within the stylesheet folder, this is a prediciment. If all else fails you can try the absolute URL and see if it even loads then. If you load up firebug, and find the element and check the styles, you can see exactly where the image is trying to be called from.
    Twitter-@Ryan_Reese09
    http://www.ryanreese.us -Always looking for web design/development work

Bookmarks

Posting Permissions

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