Pen Settings



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


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


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.


    <p id="progress" data-progress="0.3">In Progress...</p>
    <button id="progress-reset">Progress = 0%</button>
    <button id="progress-inc">Progress += 10%</button>


                #progress {
    $progressColor: hsl(100, 50%, 50%);

    position: relative;
    margin-bottom: 1rem;
    padding: 0.5rem 1rem;
    border: thin solid $progressColor;
    font-family: 'Courier', monospace;

    // progress image
    --prop--progress: 0.3;
    $progressPercentage: calc(100% * var(--prop--progress));
    $progressImage: linear-gradient(
        to right,
        $progressColor 0%,
        $progressColor #{$progressPercentage},
        transparent    #{$progressPercentage},
        transparent    100%

    // overlay image
    --overlay-progress: -0.5;
    animation: progress 2s linear infinite;
    $overlayPercentage: calc(#{$progressPercentage} * var(--overlay-progress));
    $overlayColor: rgba(255, 255, 255, 0.7);
    $overlay: radial-gradient(
        circle at     $overlayPercentage,
        $overlayColor 0.5rem,
        transparent   10%

    // composite
    background-image: $overlay, $progressImage;
    padding-left: calc(min(max(#{$progressPercentage} - 10rem, 1rem), 100% - 10rem));
        --prop--progress 0.25s ease-in-out 0.1s;

    &::after {
        position: absolute;
        top: 2.5rem;
        right: 0;
        bottom: 0;
        font-weight: bold;
        content: 'data-progress = 'attr(data-progress);

@keyframes progress {
    from { --overlay-progress: -0.5; }
    to   { --overlay-progress: 1.5; }

body {
    padding: 1rem;


                class PropObserver {
    constructor() { = new MutationObserver(this.onPropChanged);
    onSinglePropChanged = (record: MutationObserverRecord) => {
        const {target, attributeName} = record;
        const propKey = attributeName.replace(/^data-/, '');
        const propName = `--prop--${propKey}`;
        const value = target.dataset[propKey];, value);
    onPropChanged = (records: MutationObserverRecord[]) => {
    watch(element: HTMLElement, key: string) {
            name: `--prop--${key}`,
            syntax: '<number>',
            inherits: true,
            initialValue: 0.0,
        });, {
            attributes: true,
            attributeFilter: [`data-${key}`],

function setUpProgressBar() {
    const progress = document.getElementById('progress');
    const watcher = new PropObserver();, 'progress');
document.getElementById('progress-inc').addEventListener('click', () => {
        const currentProgress = parseFloat(progress.dataset['progress'], 10);
        progress.dataset['progress'] = (currentProgress + 0.1).toFixed(1);
    document.getElementById('progress-reset').addEventListener('click', () => {
        progress.dataset['progress'] = 0;

        name: `--overlay-progress`,
        syntax: '<number>',
        inherits: true,
        initialValue: -0.5,

document.addEventListener('DOMContentLoaded', () => {