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 trialDeirdre Freeman
Courses Plus Student 5,802 PointsUsing a percentage, set the paragraph to half of its current width.
I put p { width:50%; } and Its wrong so not sure what to do.....
Mike Casteel
7,960 PointsI am still unable to find the solution to this. Can you direct me on how you solved this? The answers below did not help.
Brad Zomick
2,747 PointsHey did you ever get this figured out...I tried a bunch of things and couldn't get them to pass.
Brad Zomick
2,747 PointsHey did you figure this out? I tried a bunch of things but couldn't get anything to pass.
kevinbroomall
6,643 Pointsp {width:50%;} works
Amber Schroeder
1,413 PointsActually it does not at all.
kevinbroomall
6,643 PointsThat's weird, I copied it from the answer that was accepted in the quiz after it was accepted.
shantelle smith
1,762 PointsCSS Foundations Stage 4: Values and Units
kevinbroomall
6,643 PointsThank you Shantelle!
13 Answers
Matthew Webb
990 PointsThis challenge was giving me issues until I went back and watched the video again.
In the example the div is defined with a 700px value. So when he sets the paragraph to change to {width: 50%} it is taking 50% of the 700px value.
The way I solved this was by adding a value to the div in my code editor.
div { width: initial; }
p { width: 50%; }
Before I was just adding the paragraph width changes and I assume it was looking for something to scale down to 50% from but didn't have a value set.
kevinbroomall
6,643 PointsCan anyone tell me which module this is in or link the quiz? I am trying to get this fixed.
Thanks! Kevin
Sejin Park
2,807 PointsHave you fixed it? Guil's recommendation still doesn't work!
Thanks!
Nate W
7,957 PointsThis solution worked for me: https://teamtreehouse.com/forum/using-a-percentage-set-the-paragraph-to-half-of-its-current-width-2
Robert Marmon
3,513 PointsI had the same issues and tried all the recommendations but his is what worked for me,, I rewrote my code inline
strong {color: initial; } div.wrapper {background-image: url('img/bg.jpg'); } p {width: 50%; }
Jessica Pascall
1,544 PointsI have gotten everything right until this one I simply wrote p {width: 50%; } and it isn't working I've tried writing it different ways but it still isn't working
Tyler Williams
Courses Plus Student 170 PointsWhen you set width to 50% you are changing its width to 50% of the containing div. I would need to see your specific case, but view the example below:
The wrapper div containing the paragraph is 1000px wide. The paragraph is currently 500px (or 50% of the containing div). If you wanted to make it half of its current size you would need to change the width of the paragraph to 25% in this case.
Patrick Johnson
9,505 PointsDeirdre FReeman If you're looking for a manageable way to offer up sizing based on parent relationships you should definitely check out SASS/Compass. It's offers ways to be more semantic with your mark up while also creating a really organized way to write code, especially in instances when you want an element to span a particular width of the parent.
Brent E Gust
5,540 PointsI was having the same problem. In task #2 it will accept the answer without a closing } bracket. so double check that you have properly closed your statement from the second part of the challenge.
Jacob Shirley
6,828 PointsI had to watch the video again, and retype p { width:50%; } several times until I got it to accept. I did not have to include a width to the div, or .wrapper.
Unsubscribed User
3,648 Pointskarl De Cicmic
5,815 PointsI have just had the same problem with this. I watched the video again and my answer to this is p {width:50%;} and worked. The first time around though, it didn’t work for me.
HONG ZUO GAN
12,805 Pointshi ! i realize this problem as well. so i manage to use inline style to bypass it .
<p style="width:50%;">
ilyass mougar
Courses Plus Student 2,858 PointsChange your second challenge to background-image instead of content. .wrapper { background-image: url('img/bg.jpg');}
p { width: 50%; }
shantelle smith
1,762 PointsI am stuck on this challenge as well. I tried every suggestion but it still does not work. This is my code... strong {color: initial;} div { width: 800px; padding: 2em; margin: auto; background-image: url('bg.jpg'); }
p { width:50%; }
Guil Hernandez
Treehouse TeacherHi shantelle smith,
Like Jacob mentioned, you do not need to give the div a width, padding, or margins –– keep the div as is. p { width:50%;
}
should take care of it. :)
Deirdre Freeman
Courses Plus Student 5,802 PointsDeirdre Freeman
Courses Plus Student 5,802 PointsThanks for your help!