I'm trying to display a background-image using html/css, but it only seems to show up if I put the image in certain folders.
I have an image at project/assets/background.png and I'm trying to access it from project/src/css/style.css. I tried this
background-image: url('../../assets/background.png');
but it didn't work. The spelling and path should be correct because I used vscode's autocomplete. So, I copied the image file into all the intermediate directories along the file path and tested them:
background-image: url('background.png');
background-image: url('../background.png');
background-image: url('../../background.png');
These all worked. But it seems like any path that goes into a directory doesn't work:
background-image: url('../../folder/background.png');
Does anyone have an idea why this happens?
This is my first time posting. Please tell me if I can be clearer. Thanks.