Image URLs in CSS

Why can’t I use /img/img.jpg to access the img folder from the root directory? I can link to css and js like so, or put a href to /index.php and it directs to the root index. But using /img/img.jpg just accesses sub directories. I wonder if there’s a workaround or .htaccess method?

No, that should work just fine, and it’s the best way to link to images, IMHO. Are you doing this online or on your computer? Are you sure there’s a folder called /img/ in your root folder?

Any chance there is a space in the path/filename?

or perhaps, its because that code is in your styleSheet.css file, which is in a sub folder ? If that’s the case, your relative path is off and you need to go up a directory …/images/img.jpg

The OP is using a root-relative path, so it shouldn’t matter.