Pen Settings



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


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.



Go PRO Window blinds lowered to protect code. Code Editor with window blinds (raised) and a light blub turned on.

Keep it secret; keep it safe.

Private Pens are hidden everywhere on CodePen, except to you. You can still share them and other people can see them, they just can't find them through searching or browsing.

Upgrade to PRO


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.


Make Template?

Templates are Pens that can be used to start other Pens quickly from the create menu. The new Pen will copy all the code and settings from the template and make a new Pen (that is not a fork). You can view all of your templates, or learn more in the documentation.


Screenshot or Custom Thumbnail

Screenshots of Pens are shown in mobile browsers, RSS feeds, to users who chose images instead of iframes, and in social media sharing.

This Pen is using the default Screenshot, generated by CodePen. Upgrade to PRO to upload your own thumbnail that will be displayed on previews of this pen throughout the site and when sharing to social media.

Upgrade to PRO


                //- Define some images
- var images = [];
- images.push({ alt: 'Mount Bromo, Indonesia', src: '' })
- images.push({ alt: 'Transmission towers in fog, Bled, Slovenia', src: '' })
- images.push({ alt: 'Tourists on the Canadian coast', src: '' })
- images.push({ alt: 'Burj Khalifa, Dubai, United Arab Emirates', src: '' })
- images.push({ variant: 'row-span', alt: 'A foggy Golden Gate Bridge', src: '' })
- images.push({ alt: 'A car crossing a wood bridge in Big Sur', src: '' })
- images.push({ variant: 'col-span', alt: 'A large sand dune overshadows grasslands', src: '' })
- images.push({ alt: 'Epcot center Spaceship Earth', src: '' })
- images.push({ alt: 'Fresh strawberries in outstreched hands', src: '' })
- images.push({ alt: 'Fog rushing through the trees in Yosemite Valley', src: '' })
- images.push({ alt: 'The surface of the moon', src: '' })
- images.push({ alt: 'Austere rhinoceros', src: '' })

mixin tile(obj)
    - ratio = '16x9'
    if obj.variant == 'col-span'
      - ratio = '32x9'
    else if obj.variant == 'row-span'
      - ratio = '9x80'
    div.aspect(class="aspect--" + ratio)
        img(src=obj.src, alt=obj.alt)

    a(href="", target="_blank" rel="noopener") Shuffle
    | Template

  //- Loop through all the images and create tiles from them.
    each obj in images



                /* quick grid */
.container {
  width: 93%;
  margin: auto;

/* Bootstrap-style v3 columns */
.column {
  position: relative;
  float: left;
  min-height: 1px;
  width: 25%;
  padding-left: 4px;
  padding-right: 4px;
  /* Space between tiles */
  margin-top: 8px;

.col-span {
  width: 50%;

.my-sizer-element {
  width: 8.33333%;

/* default styles so shuffle doesn't have to set them (it will if they're missing) */
.my-shuffle {
  position: relative;
  overflow: hidden;

/* Ensure images take up the same space when they load */
/* */
.aspect {
  position: relative;
  width: 100%;
  height: 0;
  padding-bottom: 100%;
  overflow: hidden;

.aspect__inner {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;

.aspect--16x9 {
  padding-bottom: 56.25%;

.aspect--9x80 {
  padding-bottom: calc(112.5% + 8px);

.aspect--32x9 {
  padding-bottom: calc(28.125% - 3px);

img {
  display: block;
  width: 100%;
  max-width: none;
  height: 100%;
  object-fit: cover;

/* Small reset */
::after {
  box-sizing: border-box;

figure {
  margin: 0;
  padding: 0;


                const Shuffle = window.Shuffle;

const myShuffle = new Shuffle(document.querySelector('.my-shuffle'), {
  itemSelector: '.js-item',
  sizer: '.js-sizer',
  buffer: 1,
We would have called your functions earlier, but we were in a bind.