#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2013
    Posts
    5
    Rep Power
    0

    Unhappy Images won't load on webpage. Where am I going wrong?


    Hi, I'm a noob. Most of what I have learned so far has been working except for adding an image using CSS. This is really frustrating.

    Details:

    I'm using a Mac, Snow Leopard, Text Wrangler, and or Komodo. html file is on desktop, as is image. Ive tried different file extensions for the image, I've tried adding quotes around the photo file that lies within the parentheses.

    Here is what I have:


    <html>
    <head>

    <style type= "text/css">

    body {background-image: url (purple fish.jpg); background-color: gray;
    }

    </style>
    </head>

    <body>
    </body>
    </html>


    Thanks.
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Oct 2009
    Location
    Nebraska, USA
    Posts
    867
    Rep Power
    275
    you shouldn't be using files with spaces in their names.

    in this case you could try this:
    Code:
    <html>
    <head>
    
    <style type= "text/css">
    
    body {background-image: url("purple%20fish.jpg"); background-color: gray;
    }
    
    </style>
    </head>
    
    <body>
    </body>
    </html>
    and see if it works.

    Also, make sure your image is in the same folder as that HTML file since thats how its referenced in the CSS section.

    Comments on this post

    • tomcat13 agrees
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2013
    Posts
    5
    Rep Power
    0
    Don's THE man!

    It was the space in the file name as you said. It didn't work at first with that 20 percent value, but when I took that out and just made it purplefish.jpg, it worked! The little image tiled my page.

    I haven't been studying code for for a day or so since this happened. I was getting frustrated to where I just wanted to give up. So thanks a lot for helping me. I appreciate it.
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Oct 2009
    Location
    Nebraska, USA
    Posts
    867
    Rep Power
    275
    yea, spaces in file names or even in file paths can cause lots of problems [and stress] for those trying to deal with them.
    If you still want to break the file name up, I suggest using - or _ between the words, but, not spaces.

    In any case, glad you have things working for you now.

IMN logo majestic logo threadwatch logo seochat tools logo