Background-image: url not locating my file

Hi everyone, I’m tryina start a new project, using VScode…

css is linked, however the image I’m trying to select doesn’t want to apply as the backroung image…

CSS
body {
background-color: #023020;
background-image: url(“background.png”);
margin: 0;
padding: 0;
background-position: center;
background-repeat: no-repeat;
background-size: cover;
background-attachment: fixed;
}

HTML

Cloud 9 Test

ERROR on browser:
GET file:///C:/Users/thula/Desktop/Projects/cloud-9/css/background.png net::ERR_FILE_NOT_FOUND

and the file is not even in the css folder

hi
If your image is in the same folder as your code, you could do this:

background-image:  url("background.png");

or simply use the img tag

<img src="backgound.png"/>

Hope it helps!!

appreciate the help…

background-image: url(“background.png”);-- still doesn’t wanna work, even when I try …/ going back 1 file up…

I guess I’ll have to use the tag.

Thank you once again

1 Like

Your welcome.
Please I’ll like to know the end result.

Try adding min-height: 100vh; to the selector.

seems to have worked, as untidy as my code is, but it was a quick fix thank you :slight_smile:

I used the style attribute on html to set the background picture. I then targeted the style on css to set the appropriate properties & their values…

1 Like

your welcome!!
Happy to help!:grinning:

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.