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. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ add another resource


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


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.


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.


                <div class="block">
    <h1>Aspect Ratio Scaling</h1>
    <span class="img"><!--just a fake image here--></span>
        It's as simple as setting the containing block's font-size using vmin,
        plus everything inside with em (or % and other relative units) so the internals are scaled relative
        to the window width and height.



// aesthetics
.block {
    position: relative;
    width: 25em;
    height: 16em;
    background-color: teal;
    padding: 1em;
    font-size: 2vmin; // the magic
    border-radius: .5em;
    &:after {
        content: "";
        position: absolute;
    &:before {
        z-index: -2;
        top: 100%;
        left: 0;
        width: 100%;
        height: 5em;
        background-image: linear-gradient(to bottom, teal, transparent);
        border-radius: .5em;
        opacity: .5;
    &:after {
        z-index: -1;
        bottom: 0;
        left: 1.25em;
        right: 1.25em;
        height: 3em;
        background-color: black;
            -.25em 0 .75em black,
            .25em 0 .75em black,
            0 .25em .75em black,
            0 -.25em .75em black;
        border-radius: .2em;
        opacity: .1;
        transform: perspective(5em) rotateX(45deg);
    h1 {
        margin: 0 0 .5em;
        font-family: 'Signika', sans-serif;
    p {
        letter-spacing: .05em;
    .img {
        position: relative;
        display: block;
        float: right;
        width: 9em;
        height: 9em;
        margin: 0 1em;
        border-radius: 50%;
        background-color: mediumaquamarine;
        box-shadow: -1em -1em 3em rgba(black, .5) inset;
        &:before {
            content: "";
            position: absolute;
            bottom: -1em;
            left: 50%;
            width: 75%;
            height: .5em;
            background-color: black;
            border-radius: 50%;
            box-shadow: 0 0 .2em black, 0 0 .5em black;
            opacity: .2;
            transform: translateX(-50%);   

// base
@import url('|Vollkorn');
*, *:before, *:after {
    box-sizing: border-box;
html, body {
    height: 100%;
body {
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: aquamarine;
    background: linear-gradient(to bottom, aquamarine 55%, teal);
    font-family: 'Vollkorn', serif;
    color: white;


                // nothing to see here, move along...