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

Can not pass "Values and Units"

Been stuck for a few days now and just can't figure this out. Get to question 3 of 3 and SPLAT! Bummer message no matter what I try.

Library > Websites > CSS Foundations > Values and Units Code Challenge: Numeric and Textual Data Types

Question 1: Set the color of the 'strong' text back to its initial color value. Answer:

strong {
  color: initial;
}

Question 2: Add 'bg.jpg' located inside the img folder as a background image to the div with the class 'wrapper'. Answer:

.wrapper {
  content: url(img/bg.jpg);
}

On A Roll!!!! Question 3: Using a percentage, set the paragraph to half of its current width.

Easy right? My first try:

p {
  width: 50%;
}

After trying several other ways I admit, just not getting it! Please help pointing me in the right direction.

html I am working with:

<!DOCTYPE html>
<html>
<head>
  <title>Numeric and Textual</title>
  <link rel="stylesheet" href="page.css">
  <link rel="stylesheet" href="style.css">
</head>
<body>
    <div class="wrapper">
        <p>
            <strong>Some</strong> Crazy <a href="#">Text</a> 
        </p>
    </div>
</body>
</html> 

4 Answers

Instead of content in:

.wrapper {
  content: url(img/bg.jpg);
}

Do background:

.wrapper {
  background: url(img/bg.jpg);
}

Also try putting quotes around your url like this:

.wrapper {
  background: url('img/bg.jpg');
}

Peculiar. Yes, this also tripped me up. I think mostly because it said I had the right answer after part 2, which lead me to believe part 3 is the part I was entering incorrectly. May be something you guys want to take a peek at :)

Thanks!

that's weird, I straight up put div {background-image: url('..img/bg.jpg');} and it worked fine.

this is crazy.... without searching the forum (technically cheating but hey! I'm a problem solver)... 2nd challenge (insert url) passes without quotes but then part 3 fails because there are no quotes on part 2.... this is madness and people could be stuck for days as as usual the error message (bummer) is not relevant...