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 trialPatsy Tisdale
5,049 PointsConverting pixels to percentages
I am having a problem with one of the objectives in this lesson: The objective is:
Using .icing as your context, convert the margins on .cake from pixels to percentages.
The icing is 800px. The margin on the cake is 10px. 10 divided by 800 is 0.0125. After moving the decimal point two places to the right, I gave 1% as my answer but that was incorrect. What am I doing wrong here?
3 Answers
Jason Anello
Courses Plus Student 94,610 PointsI tried again just now and it worked.
.cake {
background-color: #f8748f;
width: 80%; /*640px*/
margin: 1.25%;
padding: 10px;
}
Perhaps compare this with yours.
Jason Anello
Courses Plus Student 94,610 PointsHi Patsy,
You don't want to round off. It should be 1.25%
Patsy Tisdale
5,049 PointsThanks, but it didn't like 1.25%, either.
Patsy Tisdale
5,049 PointsPatsy Tisdale
5,049 PointsI don't know what I did the first time, but this time it worked. Thanks, again.