Home > Software design >  Background image from file
Background image from file

Time:10-10

I'm trying to link an image to use as a background for a HTML project by using CSS, the image is in a seperate folder, nested in the folder containing the HTML file.

This is my code:

body {background-image: url(C:\Users\*\Downloads\Website 1\images\background.png); background-size: 100% 100%; }

I can't get the link to work, so does anyone know how to make it work?

CodePudding user response:

If your CSS file is in the root folder and images contain on the images folder. You should try like this:

body {background-image: url( ./images/background.png); background-size: 100% 100%; }
  • Related