Dasmoto’s Arts & Crafts challenge, problems with adding a background image

Hello,
I’ve just completed the Dasmoto’s Arts & Crafts challenge. We are supposed to make a webpage following these instructions: https://content.codecademy.com/courses/freelance-1/unit-2/dasmotos-arts_redline.jpg
I think I finished the task, but I can’t manage to put the background-image for the h1.
Here is my code.

index.html :

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet" href="./resources/css/index.css">
</head>
<body>
    <h1 class= "bold" >Datsmoto's Arts & Crafts</h1>

    <h2 class= "bold greenblue">Brushes</h2>
    <img src="./resources/images/img_2.jpeg" alt="">
    <h3 class= "bold">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. <div class= "bold blue"> Starting at $3.00 / brush. </div></p>
    
    <h2 class= "bold pink">Frames</h2>
    <img src="./resources/images/img_3.jpeg" alt="">
    <h3 class= "bold">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. <div class= "bold blue"> Starting at $2.00 / frame.</div></p>

    <h2 class= "bold skyblue">Paint</h2>
    <img src="./resources/images/img_4.jpeg" alt="">
    <h3 class= "bold"> 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. <div class= "bold blue">Starting at $5.00 / tube.</div></p>

</body>
</html>

index.css:

.bold {
    font-weight: bold;
}

body{
    font-family: Helvetica;
}

.blue{
    color: blue;
}

h1 {
    font-size: 100px;
    color: khaki;
    text-align: center;
    background-image: url('/resources/images/img_1.jpeg');
}

h2{
    color: white;
    font-size: 32px;
}

.greenblue {
    background-color: mediumspringgreen;
}

.pink {
    background-color: lightcoral;
}

.skyblue{
    background-color: skyblue;`Preformatted text`
}

The is how my tree looks: image

Thanks you for your time.

The image path should be relative to the CSS file. The ‘/’ should work on a server, but it won’t work on local files.
So the path from the CSS should be: ‘…/images/img_1.jpeg’

1 Like

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.