When I am writing my CSS code for a background image, it works fine if I use a url from the web, however I cannot seem to get it to work for a file I have on my computer. I have images on my website that I have taken straight from my own computer file, and they show up just fine, but the background image is just not there. What am I doing wrong?
When I have an image on the website without positioning it, it looks great. However, it’s not in the place I want it. When I give it the position of “absolute” it gets scrunched up vertically. Why is this and how can I prevent it? Is this a browser problem or something wrong with the CSS code?
At a guess I would say this is a pure path issue. On the web, it sounds like you’re using a full “http://www.mysite.com/full/path/to/image.jpg” or something? Obviously that won’t work locally. You can use standard path references and that should work either way.
url(image.jpg) /* a file in the same directory /
url(folder/image.jpg) / a file in a child directory /
url(…/image.jpg) / a file in the parent directory /
url(…/folder/image.jpg) / a file in the sibling directory */
That’s a weird one. Is your webpage and CSS files valid? The W3C validator for webpages is at http://validator.w3.org/ and the CSS validator is at http://jigsaw.w3.org/css-validator/. If they validate and you still have the problem, give us a link to your website. We’ll probably need to see it live and take advantage of Firebug to diagnose it.