I have saved the photo in a some other folder in VS code and my code is in some other folder and i want to use the photo as background image in code
background-image: url("PhotosDesert.jpg");
background-size: cover;
I tried this but the image is not showing;
If I put the image in the same folder as code and use 👇 it is working
background-image: url("Desert.jpg");
background-size: cover;
2
Answers
Inorder, to traverse to the given directory you can traverse directly by copying the path into or ** you can use "../" ** to go down a directory(This works in Ubuntu operating system not sure about windows)
Current senario..
If the picture is in Desktop/Users/Pictures/Desert.jpg and you are in Documents/vscode_projects you need to write it like this.
Also you can directly type the file name if the picture is in the local folder.
You can find a detailed explanation of how relative paths work here
A small correction to your initial post will be to adjust the path since you are using backward slash
Also, the reason it works when you put it in the same folder is because the relative path is at the root
Endeavor to place the image folder inside of the project.