Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

CSS

John Lukacs
John Lukacs
26,210 Points

background image

I have the image in a folder at the same level as html and css But it won't display I set it on the body and set the body to 100vh which did nothing What am I doing wrong why wont it display

body{
  background-image: url("wood.jpg");
  height: 100vh;
}
Jordany Rosas
Jordany Rosas
Courses Plus Student 4,557 Points

Try this,

body{
  background-image: url("../wood.jpg");
  height: 100vh;
}

adding the "../" before the file.

4 Answers

Jordany Rosas
PLUS
Jordany Rosas
Courses Plus Student 4,557 Points

I can't tell much without your html code, but maybe it's because you didn't link your css on your html?

Usually though, you still use "../" before the image even if it's on the same level as your other files.

Steven Parker
Steven Parker
216,083 Points

:x: No, you do NOT use "../" before a file if it is in the same folder:exclamation:

John Lukacs
John Lukacs
26,210 Points

Its in the same folder as the html there shound not be a reason to move up a folder. I tried your code did not work I want to take my computer and throw it at the ww3

John Lukacs
John Lukacs
26,210 Points
<body>

    <div class="container text-xs-center m-t-3">
<header>
        <h1 class="display-2 text-danger"> Buggers Aquarium Ontario</h1>
        <p class="lead">
          A reef enthusiast buliding and maintaing a small reef tank
      </p>

      <div class="col-lg-6 col-md-offset-3">
          <div class="input-group">
            <input type="text" class="form-control" placeholder="Enter your email">
            <span class="input-group-btn">
              <button class="btn btn-secondary" type="button">Sign up!</button>
            </span>
John Lukacs
John Lukacs
26,210 Points

Ok it worked what a bastard you were right the css was not linked