Hi, I have a specific question about this project that is really bugging me and I can’t find the issue. I can get all of my images to work using relative paths EXCEPT when using the background-image property in CSS. In the code below, I commented out the background-image property in index.css that uses the absolute path (which works) because I have been trying to find a solution to why it won’t work when I use a relative path. I would love if someone could tell me what I did wrong!
Also, any other suggestions are welcome!
Directory:
Dasimotos Art Project
- index.html
- Resources
- CSS
- index.css
- Images
- finnish.jpg
- frames.jpg
- hacksaw.jpg
- pattern.jpg
- CSS
HTML:
Dasimoto's Art's & Craft'<header>
<h1>Dasmoto's Arts & Crafts</h1>
</header>
<main>
<section>
<h2 class="brushes">Brushes</h2>
<img src="./Resources/Images/hacksaw.jpeg" alt="Paint Brushes">
<h3>Hacksaw Brushes</h3>
<p>Made of the highest quality oak, Hacksaw brushes are known for their weight and ability to hold paint in large amounts. Available in different sizes. <span>Starting at $3.00 / brush.</span></p>
</section>
<section>
<h2 class="frames">Frames</h2>
<img src="./Resources/Images/frames.jpeg" alt="assorted picture frames">
<h3>Art Frames (assorted)</h3>
<p>Assorted frames made of different material, including MDF, birchwood, and PDE. Select frames can be sanded and painted according to your needs. <span>Starting at $2.00 / frame.</span> </p>
</section>
<section>
<h2 class="paint">Paint</h2>
<img src="./Resources/Images/finnish.jpeg">
<h3>Clean Finnish Paint</h3>
<p>Imported paint from Finland. Over 256 colors available in-store, varying in quantity (1 oz. to 8 oz.). Clean Finnish paint microbinds to canvas, increasing the finish and longevity of any artwork. <span>Starting at $5.00 / tube.</span></p>
</section>
</main>
CSS:
h1 {
/background-image: url(“https://content.codecademy.com/courses/freelance-1/unit-2/pattern.jpeg?_gl=1*1qb0c7c*_ga*NTc5NDIwNzYwMS4xNjg3MjgyODYx*_ga_3LRZM6TM9L*MTY4ODA2OTE2NC4xMS4xLjE2ODgwNzA2MjAuNTkuMC4w”);/
background-image: url(“/Resources/Images/pattern.jpeg”);
background-color: aqua;
font-family: Helvetica;
font-size: 100px;
font-weight: bold;
color: khaki;
text-align: center;
}
h2 {
font-family: Helvetica;
font-size: 32px;
font-weight: bold;
color: white;
}
.brushes {
background-color: mediumspringgreen;
}
.frames {
background-color: lightcoral;
}
.paint {
background-color: skyblue;
}
p {
font-family: helvetica;
}
span {
font-family: helvetica;
font-weight: bold;
color: blue;
}
h3 {
font-family: Helvetica;
font-weight: bold;
font-size: 18px;
}
EDIT:
I don’t know why it is not displaying the beginning of my html document when I paste it in but this is the head:
ANOTHER EDIT:
After two days of searching online I finally figured it out. it needed to be
background-image: url(“…/Images/pattern.jpeg”); and NOT background-image: url(“/Resources/Images/pattern.jpeg”);
Any and all feedback is still appreciated!