Creating a website using html and css

I’m having an issue in adding background image to the website. please tell the correct way to do this

Hello and welcome.
Please tell us what issue you have with adding background. Have you tried to add a background? Can we see the code?
Here is some css properties that can help with background:

body {
  background-image: url("url here"); /* The image used */
  background-color: #cccccc; /* Used if the image is unavailable */
  height: 500px; /* You must set a specified height */
  background-position: center; /* Center the image */
  background-repeat: no-repeat; /* Do not repeat the image */
  background-size: cover; /* Resize the background image to cover the entire container */
}

You can read w3school. It might help you.

1 Like

One thing I found difficult was getting the link exactly right in the background-image: url(THIS PART);. You have to make sure it’s in the right folder and learn how to move up and down the file structure.

For example, if it’s in the same folder, url("./mypic.jpg") works, but if it’s in a folder at the same level, you’ll have to write url("…/images/mypic.jpg").