Home > other >  How do I add a background image in CSS with the image located in my project file?
How do I add a background image in CSS with the image located in my project file?

Time:04-06

I'm new to coding. Currently working on a digital resume. I'd like to add a background image in CSS without using a url. The image is located in my project file.

I have tried to load the image in chrome and I took the url from that to css, but it didn't load. Any help? Thanks

CodePudding user response:

Maybe your CSS file is not in the same directory as your image, you may need to use relative path URL, here I'll show an example:

HTMl elements to add a picture

CSS:

CSS to add background image

Make sure you use the relative path to your image file. Otherwise it will not load.

Otherwise you could use the HTML image tag: https://www.w3schools.com/tags/tag_img.asp

  • Related