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
Chris Mursheno
Courses Plus Student 3,017 PointsContinu'd Trouble:Flex.Margin Code Challenge
I used the EXACT same logic to figure the next question on this code challenge that I employed to get the correct answer but it's giving me an error again. It prompts me to use "TARGET / CONTEXT = RESULT" So in the 1st question I divided 10px by 800px and the correct result was 1.25%. On this question, it says to convert pixels of class ".filling" to percentages using class "cake" as the divisor/context. Listed below is the syntax
cake{
width: 80%;640px
margin:1.25%
padding: 10px
}
filling{
width:75%; 480px
margin:1.56%
padding: 10px
}
So I thought to use the same formula/logic: 10px / 640= 0.0156 (1.56%) but it's giving me an error message. Sorry to keep asking so many questions
2 Answers
Shawn Denham
Python Development Techdegree Student 17,802 Pointsit looks like you are trying to convert the padding of filling by the size of cake (10px/640px)
The question as you posted it says "convert pixels of class ".filling" to percentages using class "cake" as the divisor/context."
using our formula we have 480px for filling and 640px for cake.... so you would actually do 480px\640px :)
but it looks like you all ready have 75% for the width of filling....hmm
There was one question that I remember that wanted a strange number of decimal places....assuming that the margin of .filling was 10px you might try 1.5625% and then 1.562% if that doesn't work.
I also can't remember if you need to convert ALL of filling on the step that you are on. If so remember to convert padding too.
Chris Mursheno
Courses Plus Student 3,017 PointsA great big thanks goes out to you Shawn for that. That was the answer. I wish there were guide lines as to how many decimal spaces the student should go to
James Barnett
39,199 PointsRounding up to 3 decimal places usually does the trick. The reason for this takes a bit of explanation in terms of how the math works out.
Shawn Denham
Python Development Techdegree Student 17,802 PointsJames Barnett just curious why 2 decimal places works most of the time?