Getting “Failed to load resource: net::ERR_FILE_NOT_FOUND” when trying to load a background image

How about you put the login.jpg in the same folder as the css file and change the css to

body
{
    background-image: url("login.jpg");

}

An absolute path is not correct, please use a relative one 🙂

Folder structure

MyCoolWebApp
|-> stylesheet.css
|-> login.jpg

if you want to access a file that is located in a parent folder of your stylesheet.css file, then use url("../login.jpg");

Leave a Comment