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

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,837 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