I'm trying to use the background-image property on a small site I'm making, but to no avail. Here's the code:
body {
background-image: url(/images/Pangolin.png);
background-size: center;
font-family: arial, "Times New Roman", Times, Serif;
color: #fff;
font-size: 32px;
line-height: 20px;
}
I'm 99% certain the path is correct. I've tried putting the path in quotes, but nothing seems to be working.
CodePudding user response:
use cover for background-size
body {
background-image: url( path to image );
background-size: cover;
}
CodePudding user response:
I can't comment on your question, but try to add a dot before the slash url(./images/Pangolin.png); and check your URL, this src link will be added to URL like this:
https://{url}/images/Pangolin.png like this, so check it if you use backend.
check the dev tools, open the CSS, and right-click on the link -> open in new tab.
if it still not working, send screenshots of:
- image
- select the image element the take a screenshot
- screenshot of the image location in source code
and I'll solve it...
