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
Josue Sandoval
946 PointsChallenge error or is it just me?
Build a Responsive Website > Creating a Fluid Foundation > Creating Flexible Margins
2 of 2 Challenge Task
Using .cake as your context, convert the margins on .filling from pixels to percentages.
I did this:
10 / 640 = 0.015625 = 1.56%
I put 1.56% as the answer several times and it keeps saying incorrect.
7 Answers
Josue Sandoval
946 PointsThanks I got it. :)
I was not used to seeing long percentages in css files.
Chase Lee
29,275 PointsDo the exact percentage that you get.
Josue Sandoval
946 PointsYou have to do both of the challenge questions. The first one works. The second one doesn't work for me even though I used the same technique as the first.
I gave up with the error I was getting and was forced to skip it.
Josue Sandoval
946 Points.cake {
background-color: #f8748f;
width: 80%; /*640px*/
margin: 1.25%;
padding: 10px;
}
.filling {
background-color: #4FB69F;
width: 75%; /*480px*/
margin: 1.56%;
padding: 10px;
}
Jon Morhous
Courses Plus Student 4,740 PointsTry rounding. I got it about my tenth try, (hint, hint).
Arnaud Kamphuis
528 PointsI really think they should specify what decimal level they require rounding at. I've spent over 30 minutes trying to get the right one on a similar challenge. This would take them 5 minutes to fix and would save hours of students' wasted time on something that is irrelevant to programming competencies.
James Barnett
39,199 PointsThere's actually a very good reason for why the code challenge works that way it's checking to see if it works out to the correct number of pixels. If you use a calculator to double check your work then you should be able to easily figure out if you have the correct number of decimal places.
The most obvious answer is to use a calculator on their computer and cut & paste the number including all decimal places.
Chris Hibbert
253 PointsWhy should the answer have to be 10 thousandth of a decimal place when all others have been hundreths. No reason for it whatsoever. Anyway here's the correct answer to get your tick ; )
.filling {
background-color: #4FB69F;
width: 75%; /*480px*/
margin: 1.5625%;
padding: 10px;
}
James Barnett
39,199 PointsJames Barnett
39,199 PointsThe reason rounding up to 3 decimal places work is because of how the math works out as your goal is to use a percentage that is the same number of pixels but not worry about fractional pixels.