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
Mike Casteel
7,960 PointsStuck on Code Challenge in "Numeric and Textual Data Types"
CSS Foundations > Values and Units > Numeric and Textual Data Types
Code Challenge ask "Using a percentage, set the paragraph to half of its current width" as the third question.
P { width: 50%;} is coming up as incorrect and tells me to "Check the length unit in your CSS value."
The only thing I can think of is that we have not set a width elsewhere so it does not understand the 50% command. But no matter what I have tried to add a width, I still obtain an incorrect answer.
5 Answers
Chase Lee
29,275 PointsYou have to do: background instead of content like this:
.wrapper {
background: url('img/bg.jpg');
}
Chase Lee
29,275 PointsTry using a lowercase p instead of a capital P.
Mike Casteel
7,960 PointsTypo in forum, was using lower case p to no avail.
Chase Lee
29,275 PointsCan you show me all of your code?
I might be that you have something else that they didn't catch earlier and It's giving you problems now.
Mike Casteel
7,960 Pointshtml....
<!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>Aesthetic post-ironic quinoa sartorial, wes anderson twee next level before they sold out fanny pack farm-to-table scenester.</strong> Godard fixie sartorial, keytar bicycle rights gluten-free odd future 8-bit mustache cred. Cred bushwick street art leggings fap DIY. 8-bit fanny pack quinoa vinyl art party jean shorts. Fingerstache, biodiesel kale chips narwhal pinterest tofu echo park pour-over fap raw denim craft beer. Truffaut raw denim, pop-up PBR pork belly mustache food truck cred carles synth. DIY sustainable craft beer, polaroid leggings messenger bag lo-fi twee. Keffiyeh thundercats semiotics, kogi officia tattooed gastropub viral ut skateboard street art.
<a href="#">Read more »</a>
</p>
</div>
</body>
Question 1: Set the color of the 'strong' text back to its initial color value.
CSS....
/* Write your CSS below */
strong {
color: initial;
}
Question 2: Add 'bg.jpg' located inside the img folder as a background image to the div with the class 'wrapper'.
CSS...
.wrapper {
content: url(img/bg.jpg);
}
Question 3 of 3: Using a percentage, set the paragraph to half of its current width.
I put
p {
width: 50%;
}
Returns "Bummer! Check the length unit in your CSS value"
Chase Lee
29,275 PointsTry putting quotes around your url like this:
.wrapper {
content: url('img/bg.jpg');
}
Mike Casteel
7,960 PointsTried this to no avail. Question 1 and 2 are fine.
Only question 3 is not letting me move on so there has to be something with the width property that the code does not like.It seems really simple and when putting the code
p { width: 50%; }
the preview looks correct but still comes back as incorrect. I am truly baffled. Reviewed corresponding video several times and just makes no sense.
On another note, how do you post code in the forum like you did above?
Ahmed Qureshi
2,508 PointsUsing a percentage, set the paragraph to half of its current width.
p { width: 50%; } this ans is right or wrong
Mike Casteel
7,960 PointsMike Casteel
7,960 PointsThank you, not sure why it let me past question 2 but not 3 with content instead of background.
Figured it was something easy!