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

HTML Build a Responsive Website Creating a Fluid Foundation Creating Flexible Margins

Using .cake as your context, convert the margins on .filling from pixels to percentages.

This was the question on the quiz.. When I used 640 from .cake to convert the margin on .filling I took 10/640=00156 = 1.56 %

what am I doing wrong?

Thank you

Using .cake as your context, convert the margins on .filling from pixels to percentages.

Keep getting this message Bummer! It looks like your calculation is a bit off. PreviewRecheck work

index.html

1 <!DOCTYPE html> 2 <html> 3 <head> 4 <style> 5

6 /* When setting flexible margin on an element, your context is the width of the element's container. 7 When setting flexible padding on an element, your context is the width of the element itself. */ 8

9 p { 10 margin: 0; 11 } 12 body { 13 color: #fff; 14 } 15 .container { 16 max-width: 800px; 17 } 18

19 .icing { 20 background-color: #B4C34F; 21 width: 100%; /800px/ 22 padding: 10px; 23 } 24 .cake { 25 background-color: #f8748f; 26 width: 80%; /640px/ ************************ 640 from here 27 margin: 1.25%; 28 padding: 10px; 29 } 30 .filling { 31 background-color: #4FB69F; 32 width: 75%; /480px/ 33 margin: 1.56%; /this said 10px/ ************************* 34 padding: 10px; 35 } 36 </style>

1 Answer

Cameron Bourke
Cameron Bourke
10,198 Points

Hey, your calculations are correct. However you are rounding them up to two decimal figures when instead you need to just enter the whole percentage. So in your case it will 1.5625%, not 1.56%. Hope this helps.

Thanks Cameron, just didn't think more than 2 decimals was needed but that worked. Have a great day!