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

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%