Why this code is not working?

body { background :url("https://cdn-media-1.freecodecamp.org/imgr/MJAkxbh.png"); }

It’s hard to tell without more context. But this:

background :

There should be no space there, it should be after the colon.

But I can’t tell if that is the issue without seeing all the code and understanding what you are trying to do.

Is this for a specific challenge? Please link to the challenge and show all of your code. Or, in the future, use the Get Help -> Ask for Help button - it will do that for you.

Hi,

you probably want to use the background-image, so the code should look like this:

body {
  background-image:  url("https://cdn-media-1.freecodecamp.org/imgr/MJAkxbh.png");
}

but it is always good to specify a fallback color in case that the image cannot be used… with background you can do it and also specify other properties.

body {
  background:  lightblue url("https://cdn-media-1.freecodecamp.org/imgr/MJAkxbh.png") repeat fixed center;
}

for more information you can check this site: CSS background property

1 Like