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 trialFabrizio Rinaldi
5,359 PointsConvert 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! :)
Fabrizio Rinaldi
5,359 Points1.428571429% i think that could be the right answer but doesn't work :(
Fabrizio Rinaldi
5,359 Points1.428571429% i think that could be the right answer but doesn't work :(
2 Answers
Jason Anello
Courses Plus Student 94,610 PointsHi 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
11,301 Pointsshouldn't padding be 1.428571429%, as well?
Fabrizio Rinaldi
5,359 PointsI've tried to write that, but doesn't work
Ron McCranie
7,837 PointsRon McCranie
7,837 Pointswhat answer did you give?