Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

CSS

Background image

Hi, can anyone help me please that why i cannot set the background image in header section ?

<!DOCTYPE html>
<html>
<head>
    <title>Visit---------</title>
    <link rel="stylesheet" href="main.css">

</head>
<body>
    <nav>
        <ul>
            <li><a href="#">-------------</a></li>

        </ul>
    </nav>
    <header>
        <h2 id="main_heading">--------</h2>
        <h2 id="main_heading">--------</h2>


    </header>
</body>
</html> ```

main.css ----


header{
    background-image: url("../img/Mel-night.jpg");
}

>> background image is in the img folder in the same directory

1 Answer

Hi Sandeep! If you are in the same directory as the image folder, you shouldn't need the ../ at the front of the path.

Hope that helps - let me know if you have any questions, I am happy to help ???

Thats working ! Thanks Alexandra