Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

JavaScript

Babel is required to process package imports. If you need a different preprocessor remove all packages first.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Behavior

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

HTML

              
                <!doctype html>
<html lang="en">
    <head>
        <title>Nutrition Facts Label</title>
    </head>
    <body>
        <header>
            <h1 class="main-heading heading">Nutrition Facts</h1>
        </header>
        <main>
            <div class="servings">
                <h2 class="servings-heading heading">Servings</h2>
                <div class="servings-per-container">
                    <span class="attribute">Servings Per Container</span>
                    <span class="value">8</span>
                </div>
                <div class="serving-size">
                    <span class="attribute">Serving Size</span>
                    <span class="value">
                        <span class="cup-unit">2/3 cup</span>
                        <span class="or-preposition">or</span>
                        <span class="gram-unit">55g</span>
                    </span>
                </div>
            </div>
            <div class="daily-values">
                <h2 class="daily-values-heading heading">Daily Values</h2>
                <div class="calories">
                    <div class="heading">Calories</div>
                    <div class="amount-per-serving">
                        <span class="attribute">Amount Per Serving</span>
                        <span class="value">230</span>
                    </div>
                </div>
                <div class="percent-daily-value-note">% Daily Value*</div>
                <ul class="nutrients">
                    <li class="total-fat">
                        <div class="total-fat---cr">
                            <div class="heading">Total Fat</div>
                            <div class="amount-per-serving">
                                <span class="attribute">Amount Per Serving</span>
                                <span class="value">8g</span>
                            </div>
                            <div class="percent-daily-value">
                                <span class="attribute">% Daily Value</span>
                                <span class="value">10%</span>
                            </div>
                        </div>
                        <ul>
                            <li class="saturated-fat">
                                <div class="heading">Saturated Fat</div>
                                <div class="amount-per-serving">
                                    <span class="attribute">Amount Per Serving</span>
                                    <span class="value">1g</span>
                                </div>
                                <div class="percent-daily-value">
                                    <span class="attribute">% Daily Value</span>
                                    <span class="value">5%</span>
                                </div>
                            </li>
                            <li class="trans-fat">
                                <div class="heading">
                                    <span class="trans-text">Trans</span>
                                    <span class="fat-text">Fat</span>
                                </div>
                                <div class="amount-per-serving">
                                    <span class="attribute">Amount Per Serving</span>
                                    <span class="value">0g</span>
                                </div>
                                <div class="percent-daily-value">
                                    <span class="attribute">% Daily Value</span>
                                    <span class="value">0%</span>
                                </div>
                            </li>
                        </ul>
                    </li>
                    <li class="cholesterol">
                        <div class="heading">Cholesterol</div>
                        <div class="amount-per-serving">
                            <span class="attribute">Amount Per Serving</span>
                            <span class="value">0mg</span>
                        </div>
                        <div class="percent-daily-value">
                            <span class="attribute">% Daily Value</span>
                            <span class="value">0%</span>
                        </div>
                    </li>
                    <li class="sodium">
                        <div class="heading">Sodium</div>
                        <div class="amount-per-serving">
                            <span class="attribute">Amount Per Serving</span>
                            <span class="value">160mg</span>
                        </div>
                        <div class="percent-daily-value">
                            <span class="attribute">% Daily Value</span>
                            <span class="value">7%</span>
                        </div>
                    </li>
                    <li class="total-carbohydrate">
                        <div class="total-carbohydrate---cr">
                            <div class="heading">Total Carbohydrate</div>
                            <div class="amount-per-serving">
                                <span class="attribute">Amount Per Serving</span>
                                <span class="value">37g</span>
                            </div>
                            <div class="percent-daily-value">
                                <span class="attribute">% Daily Value</span>
                                <span class="value">13%</span>
                            </div>
                        </div>
                        <ul>
                            <li class="dietary-fiber">
                                <div class="heading">Dietary Fiber</div>
                                <div class="amount-per-serving">
                                    <span class="attribute">Amount Per Serving</span>
                                    <span class="value">4g</span>
                                </div>
                                <div class="percent-daily-value">
                                    <span class="attribute">% Daily Value</span>
                                    <span class="value">14%</span>
                                </div>
                            </li>
                            <li class="total-sugars">
                                <div class="total-sugars---cr">
                                    <div class="heading">Total Sugars</div>
                                    <div class="amount-per-serving">
                                        <span class="attribute">Amount Per Serving</span>
                                        <span class="value">12g</span>
                                    </div>
                                    <div class="percent-daily-value">
                                        <span class="attribute">% Daily Value</span>
                                        <span class="value">20%</span>
                                    </div>
                                </div>
                                <div class="added-sugars-note">Includes 10g Added Sugars</div>
                            </li>
                        </ul>
                    </li>
                    <li class="protein">
                        <div class="heading">Protein</div>
                        <div class="amount-per-serving">
                            <span class="attribute">Amount Per Serving</span>
                            <span class="value">3g</span>
                        </div>
                    </li>
                </ul>
            </div>
            <div class="nutrients-declaration-requirement">
                <h2 class="heading nutrients-declaration-requirement-heading">Nutrients Declaration Requirement</h2>
                <ul>
                    <li class="vitamin-d">
                        <div class="heading">Vitamin D</div>
                        <div class="amount-per-serving">
                            <span class="attribute">Amount Per Serving</span>
                            <span class="value">2mcg</span>
                        </div>
                        <div class="percent-daily-value">
                            <span class="attribute">% Daily Value</span>
                            <span class="value">10%</span>
                        </div>
                    </li>
                    <li class="calcium">
                        <div class="heading">Calcium</div>
                        <div class="amount-per-serving">
                            <span class="attribute">Amount Per Serving</span>
                            <span class="value">260mcg</span>
                        </div>
                        <div class="percent-daily-value">
                            <span class="attribute">% Daily Value</span>
                            <span class="value">20%</span>
                        </div>
                    </li>
                    <li class="iron">
                        <div class="heading">Iron</div>
                        <div class="amount-per-serving">
                            <span class="attribute">Amount Per Serving</span>
                            <span class="value">8g</span>
                        </div>
                        <div class="percent-daily-value">
                            <span class="attribute">% Daily Value</span>
                            <span class="value">45%</span>
                        </div>
                    </li>
                    <li class="potassium">
                        <div class="heading">Potassium</div>
                        <div class="amount-per-serving">
                            <span class="attribute">Amount Per Serving</span>
                            <span class="value">235mg</span>
                        </div>
                        <div class="percent-daily-value">
                            <span class="attribute">% Daily Value</span>
                            <span class="value">6%</span>
                        </div>
                    </li>
                </ul>
            </div>
        </main>
        <footer>
            <div class="daily-value-note">* The % Daily Value (DV) tells you how much a nutrient in a serving of food contributes to a daily diet. 2,000 calories a day is used for general nutritional advice.</div>
        </footer>
    </body>
</html>
              
            
!

CSS

              
                body {
    /* Layout */
    margin: .5em;
    padding: .5em;
    /* Typography */
    font-family: sans-serif;
    /* Graphics */
    border: .25em solid black;
}

.amount-per-serving {
    
    .attribute {
        /* Layout */
        display: none;
    }
}

.percent-daily-value {
    
    .attribute {
        /* Layout */
        display: none;
    }
}

.servings {
    /* Layout */
    padding-top: .25rem;
    padding-bottom: .25rem;
}

.servings-per-container {
    
    .attribute {
        text-transform: lowercase;
    }
}

.serving-size {
    /* Layout */
    padding-top: 0;
}

.servings-heading {
        /* Layout */
    display: none;
}

.daily-values-heading {
        /* Layout */
    display: none;
}

.nutrients-declaration-requirement-heading {
    /* Layout */
    display: none;
}

.nutrients-declaration-requirement {
    
    li {
        /* Layout */
        padding-top: .25rem;
        padding-bottom: .25rem;
        /* Graphics */
        border-top: .125em solid black;
        
        &:first-of-type {
            border-top: 0;
        }
    }
}

.daily-values,
.nutrients-declaration-requirement {
    /* Graphics */
    border-top: 1em solid black;
    
    ul {
        /* Layout */
        list-style: none;
        margin: 0;
        padding: 0;
    }
    
    li {
        /* Layout */
        display: flex;
        
        .heading {
            /* Layout */
            display: flex;
            white-space: nowrap;
        }
    }
    
    .percent-daily-value {
        /* Layout */
        text-align: right;
    }
    
    .amount-per-serving {
        /* Layout */
        flex: 1 100%;
        margin: 0 .5em;
    }

    .total-fat {
        /* Layout */
        display: block;
    }
    
    .total-fat---cr {
        /* Layout */
        display: flex;
    }
    
    .total-carbohydrate {
        /* Layout */
        display: block;
    }
    
    .total-carbohydrate---cr {
        /* Layout */
        display: flex;
    }
    
    .total-sugars {
        /* Layout */
        display: block;
        padding-bottom: 0;
    }
    
    .total-sugars---cr {
        /* Layout */
        display: flex;
    }
}

.saturated-fat {
    /* Layout */
    padding-left: 1em;
}

.trans-fat {
    /* Layout */
    padding-left: 1em;
}

.dietary-fiber {
    /* Layout */
    padding-left: 1em;
}

.total-sugars---cr {
    /* Layout */
    padding-left: 1em;
}

.added-sugars-note {
    /* Layout */
    padding-left: 2em;
    padding-top: .125rem;
    /* Graphics */
    border-top: .125em solid black;
}

.serving-size {
    /* Layout */
    display: flex;
    
    .attribute {
        /* Layout */
        white-space: nowrap;
        /* Typography */
        font-weight: bold;
    }
    
    .value {
        /* Layout */
        flex: 1 100%;
        text-align: right;
        /* Typography */
        font-weight: bold;
    }
    
    .or-preposition {
        /* Layout */
        display: none;
    }
    
    .gram-unit {
        
        /* Nature */
        &:before {
            content: '(';
        }
        
        /* Nature */
        &:after {
            content: ')';
        }
    }
}

.servings-per-container {
    /* Layout */
    display: flex;
    
    .value {
        /* Layout */
        margin-right: .25em;
    }
    
    .attribute {
        /* Layout */
        order: 1;
    }
}

.percent-daily-value-note {
    /* Layout */
    padding-top: .25em;
    padding-bottom: .25em;
    text-align: right;
    /* Typography */
    font-weight: bold;
    /* Graphics */
    border-bottom: .125em solid black;
}

.calories {
    /* Layout */
    display: grid;
    grid-template:
        'a1 b1'
        'a2 b2';
    padding-top: .25rem;
    padding-bottom: .25rem;
    /* Graphics */
    border-bottom: .5em solid black;
    
    .heading {
        /* Layout */
        grid-area: a2;
        align-self: end;
        /* Typography */
        font-size: 2em;
        font-weight: bold;
    }
    
    .amount-per-serving {
        /* Layout */
        display: contents;
        margin: 0;
        
        .attribute {
            /* Layout */
            display: block;
            grid-area: a1;
            /* Typography */
            font-weight: bold;
        }
        
        .value {
            /* Layout */
            grid-area: b2;
            grid-row: b1/-1;
            justify-self: right;
            align-self: end;
            /* Typography */
            font-size: 2.5em;
            font-weight: bold;
        }
    }
}

.daily-value-note {
    /* Layout */
    padding-top: .5rem;
    padding-bottom: .5rem;
    /* Graphics */
    border-top: .5em solid black;
    /* Typography */
    font-size: .75em;
}

header {
    /* Graphics */
    border-bottom: .125em solid black;
}

.main-heading {
    /* Layout */
    margin: 0;
    /* Typography */
    font-size: 2.5em;
}

.nutrients {
    
    .heading {
        /* Typography */
        font-weight: bold;
    }
    
    .percent-daily-value {
    
        .value {
            /* Typography */
            font-weight: bold;
        }
    }
    
    li {
        /* Layout */
        padding-top: .25rem;
        padding-bottom: .25rem;
        /* Graphics */
        border-top: .125em solid black;
    }
    
    > li {

        &:first-of-type {
            /* Graphics */
            border-top: 0;
        }
    }
    
    .trans-fat {
        /* Layout */
        padding-bottom: 0;
    }
}

.total-fat {

    ul {

        .heading {
            font-weight: normal;
        }
    }
    
    .trans-text {
        /* Layout */
        margin-right: .25em;
        /* Typography */
        font-style: italic;
    }
}

.total-carbohydrate {
    
    ul {
        
        .heading {
            /* Typography */
            font-weight: normal;
        }
    }
}

.total-carbohydrate---cr {
    /* Layout */
    padding-bottom: .25rem;
}

.total-sugars---cr {
    /* Layout */
    padding-bottom: .25rem;
}
              
            
!

JS

              
                
              
            
!
999px

Console