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 trialChristine Ferguson
1,883 Points.cake margin using .icing as context
.icing width = 100% / 800 px
.cake margin = 10px
I would think the formula would be 10 / 800 = .01, making the margin 1%.
Where am I going wrong?
4 Answers
Adam Sackfield
Courses Plus Student 19,663 PointsSo the width of .icing is 800(px) and the margin on .cake is 10(px). Using target/context we can get the answer
10/800 * 100 = 1.25%
Christine Ferguson
1,883 PointsOh, my calculator was rounded to 2 decimal places, so I didn't realize it was 1.25 instead of just 1. Thanks!
Valery Kukatov
6,996 PointsIt's alright. Thanks for the offer though. :)
Valery Kukatov
6,996 PointsI just checked it out... what you have to do is use the formula... Target/Context. Your target is .icing In there it states in the comment that it's 800px Your context is .cake In there it states in the comment that it's 640px
So 800/640 = 1.25% That is your margin in percentages.
I hope that makes sense. :)
Adam Sackfield
Courses Plus Student 19,663 PointsYour answer is correct but the sum is not. The target is the margin of 10px;
Valery Kukatov
6,996 PointsOh man.. you are right. That should be fixed though, so that it doesn't happen to anyone else. Fail on my part. You meant equation not sum right? haha.
Adam Sackfield
Courses Plus Student 19,663 PointsYeah this is a comedy of errors now lol. I can delete your answer if you like and you can re-post?
Jason Moore
Courses Plus Student 10,297 PointsJason Moore
Courses Plus Student 10,297 PointsI'm having the same problem.