Reputation: 3541
I have created a folder inside wwwroot, called Media. I'm trying to set a background image with css like this:
<body style='background-image: url("~/Media/background.png")'>
But the background does not appear.
However, if I try to put is as a image it works:
<img src="~/Media/background.png" />
So, how do I handle background images?
Upvotes: 1
Views: 1178
Reputation: 152
Try the following:
<body style="background-image: url(../Media/background.png)">
Upvotes: 1
Reputation: 3084
Maybe: try to use url of image instead of relative path.
In That case I suppose `https://yourdomain/media/background.png' could do the trick.
Upvotes: 0