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
Connie Chiu
Courses Plus Student 892 Pointscalculating margin
Hi, can someone point out the error with my calculation? It seems fairly straightforward, but I just can't get pass this quiz question. Thx!
Quiz 1/2 Build a Responsive Website Creating a Fluid Foundation Creating Flexible Margins
Here is the background info:
(my calculation) pixel (of icing)=10 context (of context, or cake)=640 margin of icing=1.56%
Bummer! It looks like your calculation is a bit off.
(Quiz) Using .cake as your context, convert the margins on .filling from pixels to percentages.
p { margin: 0; } body { color: #fff; } .container { max-width: 800px; }
.icing {
background-color: #B4C34F;
width: 100%; /*800px*/
padding: 10px;
}
.cake {
background-color: #f8748f;
width: 80%; /*640px*/
margin: 1.25%;
padding: 10px;
}
.filling {
background-color: #4FB69F;
width: 75%; /*480px*/
margin: 10px;
padding: 10px;
}
2 Answers
ecp
838 PointsHey Connie!
You're super close to the right answer. Firstly, you have either rounded down the decimal or are using a calculator with limited space for calculations. The percentage you're looking for is 1.5625%
Don't round down the numbers, and try using a calculator with a lot of room ;) I know there are a number of websites and other calculating tools that will help. Personally, I use the default calculator on my smartphone or computer - but there are better options out there.
Secondly, be sure you're calculating the right Target and Context as you wrote...
(my calculation) pixel (of icing)=10 context (of context, or cake)=640 margin of icing=1.56%
...and the Code Challenge is asking for...
"Using .cake as your context, convert the margins on .filling from pixels to percentages."
Granted, this would have given you the right answer if you were able to get the entire calculation ;) BUT be sure to read the Code Challenge Task carefully in the future.
Hope this helps! If you need anything else please feel free to email me directly at help@teamtreehouse.com
Best,
Elizabeth
Eric Pan
13,398 PointsThanks Elizabeth!