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

John Lukacs
John Lukacs
26,806 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
229,644 Points

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

John Lukacs
John Lukacs
26,806 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,806 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,806 Points

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