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

Convert the padding on .cake from pixels to percentages answer not working

Hey there,

has anybody the answer for this? My solution (same value as the margin) does not seem to work.

Cheers, Torsten

It's hard for us to know what issue you are having if you don't show us your code. For some tips on how to do that, check out the tips for asking questions video located in the right hand sidebar.

Also without a link to the code challenge you are having issues with someone would have guess which one it is, to be able to test out their solution.

thanks anyway

2 Answers

Hi, You first need to know the width of your site, say 1000px

Then take the px from the padding on .cake and divide by site width.

e.g. .cake padding 65px divided by 1000px = 0.065

then move decimal two places to the right = 6.5 and thats your percentage 6.5%

Thats the answer i was looking for. Thanks a lot man!