Yeah, I had the same problem.
I found out that the relative path that I was using is didn’t account for where the CSS file is. So i had to go up two directories “…/…/” then set the path for the image. Like this:
“…/…/resources/images/Image1.jpeg”
After that it worked.
Hi, I’m also having trouble with inserting a background image in using a relative path, and I feel I’ve tried every possible permutation! My best attempt code is:
I was having the same problem and what solved my case was writing the complete image address:
header {
font-size: 100px;
font-weight: bold;
color: khaki;
text-align: center;
background-image: url("/home/leandro/projects/Dasmoto’s_Arts_&_Crafts/resources/images/pattern.webp");
}
even if a top folder, like ‘/home/’, is removed the background image wouldn’t display anymore.
Hey everybody! I am looking for some help adding a background-image to an h1 element in the Web Development Foundations, Developing Websites Locally unit. Specifically the Dasmoto’s Arts & Crafts project. I have tried every version of the relative path I can think of.
I originally started with background-image: url(“images/pattern.jpeg”);
then tried background-image: url(“resources/images/pattern.jpeg”);
then tried background-image: url(“dasmoto/resources/images/pattern.jpeg”);
then tried background-image: url(“projects/dasmoto/resources/images/pattern.jpeg”);
then tried background-image: url(“codeacademy/projects/dasmoto/resources/images/pattern.jpeg”);
then tried background-image: url(“documents/codeacademy/projects/dasmoto/resources/images/pattern.jpeg”);
lastly, I tried then tried background-image: url(“…/…/resources/images/pattern.jpeg”);