Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

HTML Build a Responsive Website Creating a Fluid Foundation Creating Flexible Margins

.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

So 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%

Oh, my calculator was rounded to 2 decimal places, so I didn't realize it was 1.25 instead of just 1. Thanks!

Valery Kukatov
Valery Kukatov
6,996 Points

It's alright. Thanks for the offer though. :)

Valery Kukatov
Valery Kukatov
6,996 Points

I 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. :)

Your answer is correct but the sum is not. The target is the margin of 10px;

Valery Kukatov
Valery Kukatov
6,996 Points

Oh 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.

Yeah this is a comedy of errors now lol. I can delete your answer if you like and you can re-post?