0

I'm really confused as to what i'm doing wrong here. The Background Image won't show up. CSS:

body {
    background-image: url("images/alfredo_dover.jfif");
}

My Folder Here

Any ideas? Thanks!

ssc-hrep3
  • 15,024
  • 7
  • 48
  • 87
Neichello
  • 23
  • 4
  • 1
    Answer depends on where the specification for body is located. When in an external CSS file inside folder css, the URL should be `url("../images/alfredo_dover.jfif");` – Gerard Feb 27 '21 at 23:57

2 Answers2

0

Try this solve and make you sure give the height.

background-image: url("../images/alfredo_dover.jfif");
-1

You need to give it a background-size: cover and give the html and body elements a height of 100%. You can also give it a background-position: center if you want to center the image.

Also, you might want to try a ./ in front of your path, in case the base url is being rewritten by the base href tag:

enter code herebackground-image: url("./images/alfredo_dover.jfif");

https://developer.mozilla.org/en-US/docs/Web/HTML/Element/base

html,body{
  height: 100%;
  margin: 0;
}

body {
    background-image: url("https://placekitten.com/400/400");
    background-size: cover;
    background-position: center;
}
symlink
  • 11,984
  • 7
  • 29
  • 50