In an HTML webpage I created, a stylesheet is attached that, among other things, uses "background-image" to add an image from a CDN, using this code _
BODY{
background-image: url(https://CDN/FILE.jpg);
}
This seems to just create a blank background -- however, when I turn off the style on the Element Inspector and then turn it on again, it works perfectly fine. What am I doing wrong?
Thanks.
CodePudding user response:
You probably forgot ""
around the link.
Try background-image: url("https://CDN/FILE.jpg");
I'd suggest making an example in codepen if this isn't the case.
CodePudding user response:
Your image address doesn't work
body {
background:center / cover no-repeat url("https://images.unsplash.com/photo-1662436267867-474127614b7a?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxlZGl0b3JpYWwtZmVlZHwyfHx8ZW58MHx8fHw=&auto=format&fit=crop&w=500&q=60");
}
<h1>Hello World!</h1>
<p>This page has an image as the background!</p>