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

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.

HTML

              
                body
  .wrapper
    h1 Image grid using flex box and CSS quantity queries
    // single image row
    figure
      .post-image
         img(src="https://unsplash.it/900/400/?random")
    // double image row
    figure
      .post-image
        img(src="https://unsplash.it/400/300/?random")
      .post-image
        img(src="https://unsplash.it/800/600/?random")
    // triple image row
    figure
      .post-image
        img(src="https://unsplash.it/375/250/?random")
      .post-image
        img(src="https://unsplash.it/396/264/?random")
      .post-image
        img(src="https://unsplash.it/399/266/?random")
              
            
!

CSS

              
                body
  background #f0c24f
.wrapper
  margin 5em auto 0 auto
  max-width 800px
h1
  font-size 1.6em
  text-align center
  padding 1em
  color #3c605d
img
  max-width 100%
  display block
figure
  margin-bottom 1.8em
  display flex
  justify-content space-between
// If we have 2 images in the row change the width to about half...
.post-image:nth-last-child(n+2):nth-last-child(-n+2):first-child
.post-image:nth-last-child(n+2):nth-last-child(-n+2):first-child ~ .post-image
  flex 0 1 48%
// if we have three images in the row change width to about a third
.post-image:nth-last-child(n+3):nth-last-child(-n+3):first-child
.post-image:nth-last-child(n+3):nth-last-child(-n+3):first-child ~ .post-image
  flex 0 1 31%

              
            
!

JS

              
                
              
            
!
999px

Console