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.

CSS Build a Responsive Website Creating a Fluid Foundation Scalable Images

Fabrizio Rinaldi
Fabrizio Rinaldi
5,359 Points

Convert the padding on .cake from pixels to percentages.

Task: Convert the padding on .cake from pixels to percentages.

.container { max-width: 700px; } .icing { background-color: #B4C34F; width: 100%; /700px/ padding: 10px; } .cake { background-color: #f8748f; width: 85.714285714%; /600px/ margin: 1.428571429%; padding: 10px; } .filling { background-color: #4FB69F; width: 83.33333333%; /500px/ margin: 1.6666666666%; padding: 10px; }

I've got a problem on this converting exercise.

Thanks for your help guys! :)

Ron McCranie
Ron McCranie
7,836 Points

what answer did you give?

Fabrizio Rinaldi
Fabrizio Rinaldi
5,359 Points

1.428571429% i think that could be the right answer but doesn't work :(

Fabrizio Rinaldi
Fabrizio Rinaldi
5,359 Points

1.428571429% i think that could be the right answer but doesn't work :(

2 Answers

Hi Fabrizio,

If you take a look at the comment in the stylesheet it mentions that the context for padding is the width of the element itself.

So you want to divide the 10px by the width of the .cake element itself, not it's parent.

David Curtis
David Curtis
11,301 Points

shouldn't padding be 1.428571429%, as well?

Fabrizio Rinaldi
Fabrizio Rinaldi
5,359 Points

I've tried to write that, but doesn't work