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 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="s-demo">
    <div class="c-masonry"></div>


// only issue here is ordering

.c-masonry {
    margin: 1.5em 0;
    padding: 0;
    column-gap: 1.5em;
    column-count: 1;
    font-size: .85em;

    &__item {
        display: inline-block;
        background: #fff;
        padding: 1em;
        margin: 0 0 1.5em;
        width: 100%;
        box-sizing: border-box;
        box-shadow: 2px 2px 4px 0 #ccc;

    /* Small Devices, Tablets */
    @media only screen and (min-width: 768px) {
        column-count: 2;

    /* Medium Devices, Desktops */
    @media only screen and (min-width: 992px) {
        column-count: 3;

    /* Large Devices, Wide Screens */
    @media only screen and (min-width: 1200px) {
        column-count: 4;
    @media only screen and (min-width: 1600px) {
        column-count: 5;

body {
    font: 1em/1.67 Verdana, Sans-serif;
    margin: 0;
    background: #e9e9e9;

.s-demo {
    margin: 3em auto;
    width: 90%;
    max-width: 1270px;



                //lets make some elements
const masonry = document.querySelector(".c-masonry");
const lorem = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. ";

Array.from(Array(15)).map((item, index) => {
    // a wee random number
    const rand = Math.floor(Math.random() * 4 + 1);

    // create the div
    let el = document.createElement("div");

    // set the class
    el.className = "c-masonry__item";

    // create a text node with content
    let newContent = document.createTextNode(index + '. ' + lorem.repeat(rand));

    // append to our new div

    // finally append