Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

HTML Build a Responsive Website Creating a Fluid Foundation Scalable Images

Incorrect challenge

This challenge requires me to convert the padding of the cake class from pixels to percentages. It incorrectly requires me to calculate this percentage using the cake class' width instead of its parent's (.icing) width. Is the challenge wrong or am I confused?

2 Answers

Can you post the code please?

<!DOCTYPE html>
<html>
    <head>
        <style>

            /* When setting ?exible margin on an element, your context is the width of the element’s container.
            When setting ?exible padding on an element, your context is the width of the element itself. */

            p {
                margin: 0;
            }
            body {
                color: #fff;
            }
            .container, .icing, .cake, .filling {
                box-sizing:border-box;
                -moz-box-sizing:border-box; /* Firefox */
                -webkit-box-sizing:border-box; /* Safari */
            }
            .container {
                max-width: 700px;
            }
            .icing {
                background-color: #B4C34F;
                width: 100%; /*700px*/
        padding: 10px;
            }
            .cake {
                background-color: #f8748f;
                width: 85.714285714%; /*600px*/
        margin: 1.428571429%;
        padding: 10px;
            }
            .filling {
                background-color: #4FB69F;
                width: 83.33333333%; /*500px*/ 
        margin: 1.6666666666%;
        padding: 10px;
            }

        </style>        
    </head>
    <body>
        <div class="container" id="container">
        <div class="icing">
            <p>Icing</p>
            <div class="cake">
                <p>Cake</p>
                <div class="filling">
                    <p>Filling</p>
                </div>
            </div>
        </div>
        </div>
    </body>
</html>

While the code specifies that ``` /* When setting ?exible margin on an element, your context is the width of the element’s container. When setting ?exible padding on an element, your context is the width of the element itself. */

However, [MDN](https://developer.mozilla.org/en-US/docs/Web/CSS/padding) specifies that a percentage value for padding is with respect to the *containing block*.