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 Scalable Images

Justinas Vaiciulis
Justinas Vaiciulis
6,944 Points

Wrong calculations for .cake padding

Hey,

so I'm trying to convert from pixels to percentage for a .cake element. I thought it's supposed to be current pixels (current padding is 10px) divided by the width of the parent element (which is .icing and it's width is 700px). So I divide 10 by 700 and then move the decimal to get 1.428571429%. However, the answer does not seem to be correct.

What am I missing here?

2 Answers

You have to divide the width of the .cake class.

10 / 600

Justinas Vaiciulis
Justinas Vaiciulis
6,944 Points

Thanks Tim! At first I couldn't understand, but then it occurred to me that we have to use the next element for calculating the margin, because margin is a distance to another object, while we need to use inside measures for calculating the padding, because padding happens in the inside of the element :)