Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource

JavaScript

Babel includes JSX processing.

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

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

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

              
                <article class="calorie-calculator">

    <header class="calorie-calculator__header">
    
        <div class="calorie-calculator__subtitle">Summary</div>

        <div class="calorie-calculator__title">Sunday, Oct 4, 2015</div>

    </header>
    <!-- /.calorie-calculator__header -->

    <section class="calorie-calculator__body">

        <div class="pie-chart  has-margin-top-50" data-pie-chart--large data-percent="75.42">

            <div class="pie-chart__label">
                <div class="pie-chart__title">3039</div>
                <div class="pie-chart__subtitle">Your goal</div>
            </div>
            <!-- /.pie-chart__label -->

        </div>
        <!-- /.pie-chart -->

        <div class="pie-chart__group pie-chart__group--50-50  has-margin-top-40">
            
            <div class="pie-chart" data-pie-chart--small data-percent="46.56" data-bar-color="#fff">

                <div class="pie-chart__label">
                    <div class="pie-chart__title">61g/131g</div>
                    <div class="pie-chart__subtitle">Protein</div>
                </div>
                <!-- /.pie-chart__label -->

            </div>
            <!-- /.pie-chart -->

            <div class="pie-chart" data-pie-chart--small data-percent="24.57">

                <div class="pie-chart__label">
                    <div class="pie-chart__title">129g/525g</div>
                    <div class="pie-chart__subtitle">Carbs</div>
                </div>
                <!-- /.pie-chart__label -->

            </div>
            <!-- /.pie-chart -->

        </div>
        <!-- /.pie-chart__group -->

    </section>
    <!-- /.calorie-calculator__body -->

    <footer class="calorie-calculator__footer">
        
        <div class="stats-bar">
            
            <div class="stats-bar__left">
                
                <div class="stats-bar__content">

                    <div class="stats-bar__title">2292</div>
                    <div class="stats-bar__subtitle">Consumed</div>

                </div>
                <!-- /.stats-bar__content -->

            </div>
            <!-- /.stats-bar__left -->

            <div class="stats-bar__right">

                <div class="stats-bar__content">

                    <div class="stats-bar__title">747</div>
                    <div class="stats-bar__subtitle">Remaining</div>

                </div>
                <!-- /.stats-bar__content -->
                
            </div>
            <!-- /.stats-bar__right -->

        </div>
        <!-- /.stats-bar -->

    </footer>
    <!-- /.calorie-calculator__footer -->
    
</article>
<!-- /.calorie-calculator -->
              
            
!

CSS

              
                @import 'bourbon';

@import url(https://fonts.googleapis.com/css?family=Montserrat:400,700);

$color-black: #000;
$color-black-alt: #333;
$color-blue: #b686ff;
$color-gray: #999;
$color-white: #fff;

// Margin Helper - Increments of 5 from 5px to 300px
@for $i from 1 through 60 {

    .has-margin-bottom-#{$i * 5} {
        margin-bottom: 5px * $i;
    }
    // .has-margin-bottom-x

    .has-margin-top-#{$i * 5} {
        margin-top: 5px * $i;
    }
    // .has-margin-top-x

}

html {
    @include linear-gradient(#fffeb8, #bbf794);
    -webkit-font-smoothing: antialiased;
    box-sizing: border-box;
    height: 100%;
}
// html

*, 
*:before, 
*:after {
    box-sizing: inherit;
    line-height: inherit;
}
// *, *:before, *:after

.calorie-calculator {
    @include linear-gradient(-45deg, #000 0%, #4d4d4d 70%);
    @include transform(translate(-50%, -50%));
    border-radius: 5px;
    box-shadow: 30px 30px 100px 0px rgba($color-black, 0.5);
    color: $color-white;
    font-family: 'Montserrat', sans-serif;
    height: 650px;
    left: 50%;
    padding: 46px 0 40px 0;
    position: absolute;
    text-align: center;
    top: 50%;
    width: 400px;

    &__footer {
        bottom: 40px;
        left: 50px;
        position: absolute;
        right: 50px;
    }
    // &__footer 

    &__title {
        font-size: 22px;
    }
    // &__title

    &__subtitle {
        color: $color-gray;
        margin-bottom: 15px;
    }
    // &__subtitle

}
// .calorie-calculator

.pie-chart {
    position: relative;

    &__label {
        @include transform(translateY(-50%));
        left: 0;
        position: absolute;
        right: 0;
        text-align: center;
        top: 50%;
    }
    // &__label 

    canvas {
        margin: 0 auto;
    }
    // canvas

    &__title {
        font-size: 22px;
    }
    // &__title

    &__subtitle {
        color: $color-gray;
        font-size: 15px;
        margin-top: 5px;
    }
    // &__subtitle

    &__group {

    }
    // &__group

    &__group--50-50 {
        @include clearfix();
        padding: 0 50px;

        .pie-chart {
            @include clearfix();
            float: left;
            width: 50%;

            &__label {
                left: 40px;
                text-align: left; 
            }
            // &__label

            canvas {
                float: left;
            }
            // canvas

            &__title {
                font-size: 14px;
            }
            // &__title

            &__subtitle {
                font-size: 14px;
                margin-top: 7px;
            }
            // &__subtitle

        }
        // .pie-chart

    }
    // &__group--50-50

}
// .pie-chart

.stats-bar {
    @include clearfix();
    background-color: $color-blue;
    height: 90px;

    &__content {
        @include transform(translateY(-50%));
        left: 0;
        position: absolute;
        top: 50%;
        width: 100%;
    }
    // &__content

    &__title {
        font-size: 22px;
    }
    // &__title

    &__subtitle {
        font-size: 14px;
        margin-top: 5px;
    }
    // &__subtitle

    &__left,
    &__right {
        bottom: 0;
        height: 100%;
        position: absolute;
        width: 50%;
    }
    // &__left, &__right

    &__left {
        left: 0;
    }
    // &__left

    &__right {
        @include transition(all 1000ms linear);
        background-color: $color-white;
        box-shadow: 10px 10px 20px 0 rgba($color-black, 0.2);
        right: 0;

        .page-loaded & {
            bottom: 10px;
            right: 10px;
        }
        // .page-loaded

        .stats-bar__title {
            color: $color-black-alt;
        }
        // .stats-bar__title

        .stats-bar__subtitle {
            color: $color-gray;
        }
        // .stats-bar__subtitle

    }
    // &__right

}
// .stats-bar
              
            
!

JS

              
                $(function() {
  
    $('[data-pie-chart--large]').easyPieChart({
        animate: 1000,
        barColor: '#cefeae',
        lineWidth: 20,
        scaleLength: 0,
        size: 220,
        trackColor: '#5a5a59'
    });

    $('[data-pie-chart--small]').easyPieChart({
        animate: 1000,
        barColor: '#cefeae',
        lineWidth: 3,
        scaleLength: 0,
        size: 30,
        trackColor: '#5a5a59'
    });

});

window.onload = function() {
    $('body').addClass('page-loaded');
}

/**!
 * easy-pie-chart
 * Lightweight plugin to render simple, animated and retina optimized pie charts
 *
 * @license 
 * @author Robert Fleischmann <[email protected]> (http://robert-fleischmann.de)
 * @version 2.1.7
 **/
!function(a,b){"function"==typeof define&&define.amd?define(["jquery"],function(a){return b(a)}):"object"==typeof exports?module.exports=b(require("jquery")):b(jQuery)}(this,function(a){var b=function(a,b){var c,d=document.createElement("canvas");a.appendChild(d),"object"==typeof G_vmlCanvasManager&&G_vmlCanvasManager.initElement(d);var e=d.getContext("2d");d.width=d.height=b.size;var f=1;window.devicePixelRatio>1&&(f=window.devicePixelRatio,d.style.width=d.style.height=[b.size,"px"].join(""),d.width=d.height=b.size*f,e.scale(f,f)),e.translate(b.size/2,b.size/2),e.rotate((-0.5+b.rotate/180)*Math.PI);var g=(b.size-b.lineWidth)/2;b.scaleColor&&b.scaleLength&&(g-=b.scaleLength+2),Date.now=Date.now||function(){return+new Date};var h=function(a,b,c){c=Math.min(Math.max(-1,c||0),1);var d=0>=c?!0:!1;e.beginPath(),e.arc(0,0,g,0,2*Math.PI*c,d),e.strokeStyle=a,e.lineWidth=b,e.stroke()},i=function(){var a,c;e.lineWidth=1,e.fillStyle=b.scaleColor,e.save();for(var d=24;d>0;--d)d%6===0?(c=b.scaleLength,a=0):(c=.6*b.scaleLength,a=b.scaleLength-c),e.fillRect(-b.size/2+a,0,c,1),e.rotate(Math.PI/12);e.restore()},j=function(){return window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||function(a){window.setTimeout(a,1e3/60)}}(),k=function(){b.scaleColor&&i(),b.trackColor&&h(b.trackColor,b.trackWidth||b.lineWidth,1)};this.getCanvas=function(){return d},this.getCtx=function(){return e},this.clear=function(){e.clearRect(b.size/-2,b.size/-2,b.size,b.size)},this.draw=function(a){b.scaleColor||b.trackColor?e.getImageData&&e.putImageData?c?e.putImageData(c,0,0):(k(),c=e.getImageData(0,0,b.size*f,b.size*f)):(this.clear(),k()):this.clear(),e.lineCap=b.lineCap;var d;d="function"==typeof b.barColor?b.barColor(a):b.barColor,h(d,b.lineWidth,a/100)}.bind(this),this.animate=function(a,c){var d=Date.now();b.onStart(a,c);var e=function(){var f=Math.min(Date.now()-d,b.animate.duration),g=b.easing(this,f,a,c-a,b.animate.duration);this.draw(g),b.onStep(a,c,g),f>=b.animate.duration?b.onStop(a,c):j(e)}.bind(this);j(e)}.bind(this)},c=function(a,c){var d={barColor:"#ef1e25",trackColor:"#f9f9f9",scaleColor:"#dfe0e0",scaleLength:5,lineCap:"round",lineWidth:3,trackWidth:void 0,size:110,rotate:0,animate:{duration:1e3,enabled:!0},easing:function(a,b,c,d,e){return b/=e/2,1>b?d/2*b*b+c:-d/2*(--b*(b-2)-1)+c},onStart:function(a,b){},onStep:function(a,b,c){},onStop:function(a,b){}};if("undefined"!=typeof b)d.renderer=b;else{if("undefined"==typeof SVGRenderer)throw new Error("Please load either the SVG- or the CanvasRenderer");d.renderer=SVGRenderer}var e={},f=0,g=function(){this.el=a,this.options=e;for(var b in d)d.hasOwnProperty(b)&&(e[b]=c&&"undefined"!=typeof c[b]?c[b]:d[b],"function"==typeof e[b]&&(e[b]=e[b].bind(this)));"string"==typeof e.easing&&"undefined"!=typeof jQuery&&jQuery.isFunction(jQuery.easing[e.easing])?e.easing=jQuery.easing[e.easing]:e.easing=d.easing,"number"==typeof e.animate&&(e.animate={duration:e.animate,enabled:!0}),"boolean"!=typeof e.animate||e.animate||(e.animate={duration:1e3,enabled:e.animate}),this.renderer=new e.renderer(a,e),this.renderer.draw(f),a.dataset&&a.dataset.percent?this.update(parseFloat(a.dataset.percent)):a.getAttribute&&a.getAttribute("data-percent")&&this.update(parseFloat(a.getAttribute("data-percent")))}.bind(this);this.update=function(a){return a=parseFloat(a),e.animate.enabled?this.renderer.animate(f,a):this.renderer.draw(a),f=a,this}.bind(this),this.disableAnimation=function(){return e.animate.enabled=!1,this},this.enableAnimation=function(){return e.animate.enabled=!0,this},g()};a.fn.easyPieChart=function(b){return this.each(function(){var d;a.data(this,"easyPieChart")||(d=a.extend({},b,a(this).data()),a.data(this,"easyPieChart",new c(this,d)))})}});
              
            
!
999px

Console