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
Chris Mursheno
Courses Plus Student 3,017 PointsTrouble with Flexible margins quiz question
The formula is: TARGET / CONTEXT = RESULT
Using ".icing" as the context, & ".cake" as the target; ICING=800px & CAKE=10px, thus if I do 10 / 800, I get 0.0125 (.01%) I've tried using both widths; ie: cake-640px / icing-800 & get 0.80(80%) I tried about 20 different ways to divide the #s & it kept saying I was incorrect. What am I doing wrong????????
5 Answers
Kevin Korte
28,149 PointsYou're almost there.
10 / 800 is correct. But to be a bit more precise, it's 1.25%. That should be what the margin of .cake is set too.
Chris Mursheno
Courses Plus Student 3,017 PointsOh, one of the answers was 1.2% so I guess I left off the last digit. I can't thank U enough 4 that! Hopefully I'll see green when I get back to it!!!!
Kevin Korte
28,149 PointsSounds good. I usually try to be as exact as possible, and let the computer deal with all of the numbers or possible rounding. You should get the green light, I just re did that code challenge and it passed me on that.
Christian Parker
4,222 Points10/800 = .0125 * 100 = 1.25%
Looks like you're forgetting to multiply by 100 (or just move the decimal 2 places to the right).
Chris Mursheno
Courses Plus Student 3,017 PointsMany thanks to Kevin & Christian, nailed it with that answer.