#Background image wont show
47 messages · Page 1 of 1 (latest)
Try doing /img/Background.jpg with the leading slash so that it looks at the root of your site
Are you seeing the background color at all?
Yes i am but I dont actually want the bg colour
I was just testing it
Ill try that though
The docs say you're supposed to quote it too?```css
background-image: url("../../media/examples/lizard.png");
Yeah, I'm not sure how mandatory that is
unfortunately this did not work
It's hard to tell what the issue is from what you've shared
If you open the dev console do you see any errors loading the image?
yes i just checked it says failed to load
What's the error
Try putting the image URL in quotes
It's escaping the slash, that's what all that mess is after img
If the server is a unix filesystem but the user is accustomed to windows, it's possible they need to be more aware of case sensitivity too?
Also tried, still nothing
Windows doesn't really allow such shenanigans. 😄
I typed it out exactly how the file name is though
And you can load that image in a browser manually?
Yes, but ive just noticed when i ctrl click on the path it doesnt take me to the img
its like it cant find the path but i swear ive linked it correctly
Share the url you're loading and the url it thinks is the image
Is that not the same url from the original screenshot?
and also it doesnt show anything for the url it thinks it is it just comes up with an error in vscode
You mean this screenshot? you can see the URL is mangled to hell
Try a known good image URL? https://jsbin.com/leduhonisa/edit?html,css,output
Put quotes around the url
Tried again it doesn't seem to work
That url is looking in the folder page-framework/css/img which I don't think is correct
Are you doing some kind of build step?
Is the image url prefixed with the /?
It is not no
That leading slash tells the browser that the image URL is absolute, if you remove it the URL becomes relative to the current URL
You want the slash at the start. It'll tell the browser to look at 127.0.0.1:5500/img and not at 127.0.0.1:5500/page-framework/css/img
So the image is in page-framework/img?
Yes
So your CSS should be /page-framework/img/Background.jpg
Awesome!