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 CSS Basics (2014) Basic Layout Styling the "Wildlife" div with Background Properties

STAGE 5 CHALLENGE TASK 5 0F 5

Finally, give .wildlife the property and value that forces any padding and border widths into its total width and height.

style.css
/* Complete the challenge by writing CSS below */
.wildlife {
  background-image: url('img/bear.jpg');
  background-repeat: no-repeat;
  background-position: center;
  background-size: cover;
  max-width: 100%;
}
index.html
<!DOCTYPE html>
<html>
  <head>
    <title>Lake Tahoe</title>
    <link rel="stylesheet" href="page.css">
    <link rel="stylesheet" href="style.css">
  </head>
  <body> 
        <div class="primary-content t-border">
            <p class="intro">
                Lake Tahoe is one of the most breathtaking attractions located in California. It's home to a number of ski resorts, summer outdoor recreation, and tourist attractions. Snow and skiing are a significant part of the area's reputation.
            </p>
            <a class="callout" href="#more">Find out more</a>
      <div class="wildlife">
        <h2>Check out all the Wildlife</h2>
        <p>
          As spawning season approaches, the fish acquire a humpback and protuberant jaw. After spawning, they die and their carcasses provide a feast for gatherings of <a href="#mink">mink</a>, <a href="#bears">bears</a>, and <a href="#eagles">bald eagles</a>.
        </p>
      </div><!-- End .wildlife -->
            <a class="callout" href="#wildlife">See the Wildlife</a>
        </div><!-- End .primary-content -->
  </body>
</html>

2 Answers

Gary Stephens
Gary Stephens
11,061 Points

Hi,

As Alan posted i also used, box-sizing: border-box; as no values were given, the question just asks for the values to be included in the total value. A previous video introduces Box-Sizing.

.wildlife { background-image: url("img/bear.jpg"); background-repeat: no-repeat; background-position: center; background-size: cover; box-sizing: border-box; }

Alex Heil
Alex Heil
53,547 Points

hello, usually padding and borders are added to the element itself. so say you want an element to have a width of 200px and you then add 10px padding the element would be 220px wide (200px element + 10px left padding + 10px right padding).

good for us we can change the box-model to something called border-box - with this in place the 10px padding from my example would be calculated automatically, means the width we define for an element doesn't change - when we say it's 200px it really is 200px.

that said let's apply this to the challenge, like so:

.widlife {
box-sizing: border-box;
}

with that one line added to your code everything will be fine. hope that helps and have a nice day ;)

Alan Fidelino
Alan Fidelino
12,846 Points

Hi MUZ140079 Ganyo,

Just adding my 2 cents worth to whatAlex said above... I just finished the challenged and since there are no values in the challenge for the padding and borders, I just added the box-sizing property as shown below:

.wildlife { background-image: url('img/bear.jpg'); background-repeat: no-repeat; background-position: center; background-size: cover; box-sizing: border-box; /this is the last piece of css rule I applied to finish the challenge/ }

Hope this helps!