All of the CSS files are located in the src/main/resources/public/css
directory, while the images are stored in src/main/resources/public/images
.
When attempting to access images from style sheets, like this example:
background-image: url("/images/dp.jpg");
, the URL becomes relative to the css
directory and as a result, the images are not being served. Currently, the only way it works is by placing all the images in the css folder itself and specifying the background as
background-image: url("dp.jpg");
. However, I prefer not to change the directory structure this way.
I have also attempted using a fully qualified URL such as
background-image: url("http://localhost:8080//images/dp.jpg");
, but this method was unsuccessful. Is there a simpler way to access images in the
/images
directory from stylesheets in the /css
directory?