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

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

Formula not coming out to work for me

When asked to use .cake as the context and change the margin on .filling from pixels to percentages, I am not able to get the correct answer. I divided the 10px margin by the .cake (640px) container width. Please tell me what I am doing wrong. I got the first question in this series correct. Thanks!

2 Answers

Can you post the entire question along with the code? It would make it a lot easier to help you.

Dave McFarland
Dave McFarland
Treehouse Teacher

Hi Hannah,

The formula to figure this out is target/context * 100 = result %. To determine margin size, you start with the pixel width of your target margin: In this case it's 10px; then you divide that by the container's width (here the container is the .cake element and it's width is 640px; finally, you multiple that result by 100 to get a percentage value:

(10/640) * 100 = 1.5625%