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 trialHenning Staves
5,085 PointsProblem with converting px to %
He Guys i need help, maybe i cannot see the wood for the trees The chapter of responsive websites there is following question and i cant seem to find the problem with my answer. The first task was to convert the margin of cake which worked fine.
Using .cake as your context, convert the margins on .filling from pixels to percentages.
.icing {
width: 100%; /*800px*/
.cake {
width: 80%; /*640px*/
margin: 1.25%; /*10px / 800 = 0.0125*/
.filling {
width: 75%; /*480px*/
margin: 1.56%; /*10px / 640 = 0.0156*/
Where is my mistake?
Thank you very much in advanced!
Henning
5 Answers
Kristopher Van Sant
Courses Plus Student 18,830 PointsHello I would double check your calculations, It looks like you rounded the filling margin percentage.
Jason Lacy
2,717 PointsI was doing the same thing, just don't round your calculation total at all and you should have it.
Henning Staves
5,085 PointsThank you so much for your help! It was driving me crazy
Can you tell me please if we should not do any rounding at all?
Kristopher Van Sant
Courses Plus Student 18,830 PointsWhen doing your own personal work with html and css rounding up won't hurt. And while your designing a site I don't think that very slight number change will affect how you want the site to look. For this specific exercise and a few others Im guessing they want you to be exact when you can be. And when getting into programming you'll probably need to be more exact too.
Henning Staves
5,085 PointsKristopher thank you very much for your answers!