Can not access from css file to images folder files

Hello! What could be problem why I can not access from css file to image folder file pattern.jpeg?
If I place this file in same folder as css file and edit path to it as they are in same folder - than I can see background image, but if I store it in separate folder than image is not shown.

File paths are all about relative vs absolute.

When you start a file with / you’re saying: start at the root directory.
As an example you can open your shell or git bash and type ls / (which lists all files, folders in that directory. You will indeed see your root folder.

If you want to deal with your current folder, the . prefix says: from the current directory, look in the following.

So for example if your index.css is in the same folder as your image. The url should be something like ./pattern.jpg (it also often works to just put pattern.jpg without anything else, the ./ is implicit in this case). I say often because in some other contexts, (non-css) this may not be the case.

If you want to go say, go to the parent directory of my current directory you would use ... So for example if you wanted to get something from the images folder from your index.css you’d do ../images/finnish.jpg, assuming your current directory is css.


Thank you! That part about ../images/ I was missing. Problem solved.

I guess that could be added in teaching materials.