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

Auto Save

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

              
                <div class="c-skeleton"></div>
              
            
!

CSS

              
                //  Helper function to replace characters in a string
@function str-replace($string, $search, $replace: "") {
    $index: str-index($string, $search);

    @return if($index,
    str-slice($string, 1, $index - 1) + $replace +
    str-replace(str-slice($string, $index +
    str-length($search)), $search, $replace),
    $string);
}

//  Function to create an optimized svg url
//  Version: 1.0.6
// https://codepen.io/jakob-e/pen/doMoML
@function svg-url($svg) {

    //  Add missing namespace
    @if not str-index($svg,xmlns) {
        $svg: str-replace($svg, "<svg", "<svg xmlns='http://www.w3.org/2000/svg'");
    }

    //  Chunk up string in order to avoid
    //  "stack level too deep" error
    $encoded: "";
    $slice: 2000;
    $index: 0;
    $loops: ceil(str-length($svg)/$slice);

    @for $i from 1 through $loops {
        $chunk: str-slice($svg, $index, $index + $slice - 1);
        //   Encode
        $chunk: str-replace($chunk, "'", "\'");
        $chunk: str-replace($chunk, "%", "%25");
        $chunk: str-replace($chunk, "#", "%23");
        $chunk: str-replace($chunk, "{", "%7B");
        $chunk: str-replace($chunk, "}", "%7D");
        $chunk: str-replace($chunk, "<", "%3C");
        $chunk: str-replace($chunk, ">", "%3E");

        //    The maybe list
        //    Keep size and compile time down
        //    ... only add on documented fail
        //
        //  $chunk: str-replace($chunk, "&", "%26");
        //  $chunk: str-replace($chunk, "|", "%7C");
        //  $chunk: str-replace($chunk, "[", "%5B");
        //  $chunk: str-replace($chunk, "]", "%5D");
        //  $chunk: str-replace($chunk, "^", "%5E");
        //  $chunk: str-replace($chunk, "`", "%60");
        //  $chunk: str-replace($chunk, ";", "%3B");
        //  $chunk: str-replace($chunk, "?", "%3F");
        //  $chunk: str-replace($chunk, ":", "%3A");
        //  $chunk: str-replace($chunk, "@", "%40");
        //  $chunk: str-replace($chunk, "=", "%3D");

        $encoded: #{$encoded}#{$chunk};
        $index: $index + $slice;
    }

    @return url("data:image/svg+xml,#{$encoded}");
}

// Skeleton screen
// https://css-tricks.com/building-skeleton-screens-css-custom-properties/

$color-athens-gray: #ECECED;

$rectangle: svg-url('<svg viewBox="0 0 420 60" xmlns="http://www.w3.org/2000/svg" preserveAspectRatio="none"><rect width="420" height="60" rx="6" fill="#ECECED" /></svg>');

.c-skeleton {
    height: 100%;
    background-repeat: no-repeat;
    background-image:
        linear-gradient(
            90deg,
            transparent 20%,
            rgba(#fff, 0.6),
            transparent 80%
        ),
        linear-gradient($color-athens-gray 25px, transparent 0),
        linear-gradient($color-athens-gray 10px, transparent 0),
        $rectangle,
        $rectangle;
    background-size:
        40% 100%,
        100% 25px,
        50% 10px,
        100% 60px,
        100% 60px;
    background-position:
        -150% 0,
        0 0,
        0 35px,
        0 75px,
        0 150px;
    animation:
        loading 1.8s ease-out infinite,
        show 0.3s ease-out forwards;
}

@keyframes loading {
    to {
        background-position:
            150% 0,
            0 0,
            0 35px,
            0 75px,
            0 150px;
    }
}

/* DEMO ONLY STUFF*/

html, body {
   height: 100%;
   padding: 20px;
}

div {
   max-width: 600px;
   margin: 0 auto;
}
              
            
!

JS

              
                
              
            
!
999px

Console