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 trialAry de Oliveira
28,298 PointsCSS
Challenge task 3 of 3
Using a percentage , set the paragraph to half of its current width .
/* Write your CSS below */ strong{ color:initial; }
div{ width:700px; padding:2em; margin:auto; background-image:url("bg.jpg"); }
p { /color: red;/
width: 50%; font-size: 75%; }
<!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>
</html>
/* Write your CSS below */
strong{
color:initial;
}
div{
width:700px;
padding:2em;
margin:auto;
background-image:url("bg.jpg");
}
p {
/*color: red;*/
width: 50%;
font-size: 75%;
}
16 Answers
Stefan Claudiu Tiulea
7,110 PointsRemove width:700px; from your div. If I'm not mistaken, p inherits the values from its parent (the div), and the 50% represents the value of that div, not the standard value...
Ary de Oliveira
28,298 Pointsthank you for the explanation, I'll keep studying
Thank you
Stefan Claudiu Tiulea
7,110 PointsHave you tried .wrapper p {width: 50%};?
Ary de Oliveira
28,298 Pointsyes
Stefan Claudiu Tiulea
7,110 PointsI just tried with p {width: 50%;} (like you did) and it works, so the error must lie somewhere else (not with you). What error are you receiving? Also, for the background image, I used background: url('img/bg.jpg'); -- sometimes the software is touchy.
Ary de Oliveira
28,298 PointsBummer Check the length unit in your CSS VALUE
Ary de Oliveira
28,298 PointsNO NO WORK SORRY
Stefan Claudiu Tiulea
7,110 PointsDude, what error message are you getting? Paste the error message here.
Ary de Oliveira
28,298 PointsBummer! Check the length unit in your CSS value.
can you send your code so on...
Ary de Oliveira
28,298 Pointsno no work... inconsistent we need Harold Finch we need Root
Ary de Oliveira
28,298 Pointsi try
Ary de Oliveira
28,298 PointsCool.... but i not understand ,
Ary de Oliveira
28,298 PointsStefan thanks... good Job
Ary de Oliveira
28,298 PointsStefan thanks... good Job
Ary de Oliveira
28,298 Pointsin my opinion, unfounded I do not understand
Stefan Claudiu Tiulea
7,110 PointsI suspect that the TeamTreeHouse software expected p to have a certain width value that originates from 50%, but when you gave the div a fixed value of 700px, since the div is the parent of the p, the p inherited a different width value; and the value the software expected to read, changed.
You will understand in the future when you become familiar with css inheritance. Here's a link:
http://reference.sitepoint.com/css/inheritance
For now, learn the basics! :)