I am attempting to utilize a background-image
with a "root-relative" path like this:
background-image: url("/img/bg.jpg");
.
In Chrome, the property is showing correctly but the image does not appear. When I change it to http://localhost:8080/img/bg.jpg
, the image shows up.
If I go to http://localhost:8080/img/bg.jpg
, I can see the image.
When I add an
<img style={{width:"100px", height:"100px"}} src="/img/bg.jpg"/>
, it displays properly (I am using React).
I searched SO briefly and found others experiencing issues with url
, but none of them matched mine.
If there is any relevance, I am using Less with webpack-dev-server. The image is located in a static directory.