Pen Settings

HTML

CSS

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

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

              
                - var items = [ 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque luctus non tellus nec egestas. Donec ornare, nibh nec lacinia efficitur, lectus dolor consequat sem, eu sagittis nisi lectus eget mi. Nulla non metus nulla. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus.', 'Praesent pellentesque elit non dui finibus, malesuada tincidunt lorem laoreet. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam eget rhoncus justo, non consequat justo. Integer consequat sit amet mauris sed lacinia. In lobortis tincidunt odio at finibus. In in mauris ut neque aliquet efficitur sit amet eu metus.', 'Donec at efficitur augue. Duis ornare diam et tristique ullamcorper. Sed ullamcorper leo at ligula ultricies feugiat. Vivamus erat purus, blandit sit amet est sed, feugiat iaculis dolor.', 'Morbi a libero dictum, tempus lectus sit amet, luctus magna. Aliquam rutrum nunc eros, sed dignissim libero iaculis sit amet. Aliquam erat volutpat. Nulla facilisi. Phasellus ac leo vel est ultricies faucibus. Sed id semper diam.', 'Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae. Fusce eros mauris, congue vitae purus quis, suscipit semper metus. Praesent non velit lectus.', 'Pellentesque at sodales magna. Nullam id vestibulum urna. Etiam semper vehicula nibh, id fringilla velit vestibulum eu. Donec maximus, ligula quis consequat scelerisque, sapien risus sollicitudin erat, id malesuada sapien quam a odio.', 'Mauris vitae orci ullamcorper elit fringilla volutpat. Curabitur vehicula bibendum nibh, eu fringilla arcu ullamcorper et. Morbi massa ex, viverra eu risus id, ultricies luctus dolor. Ut ut laoreet purus.', 'Duis ornare diam et tristique ullamcorper. Sed ullamcorper leo at ligula ultricies feugiat. Vivamus erat purus, blandit sit amet est sed, feugiat iaculis dolor. Nunc vel nulla diam.', 'Pellentesque at sodales magna. In hac habitasse platea dictumst. Vestibulum aliquet feugiat quam ac maximus. Nam ligula neque, tincidunt eu mauris at, maximus rhoncus elit. Vestibulum porta euismod dignissim.', 'Fusce eros mauris, congue vitae purus quis, suscipit semper metus. Fusce sagittis nisl vitae volutpat fringilla. Donec elementum nisi eget augue egestas pharetra. Etiam sit amet pharetra felis. Ut eu velit nec massa vehicula tincidunt sit amet vel lectus.', 'Aliquam erat volutpat. Nulla facilisi. Phasellus ac leo vel est ultricies faucibus. Sed id semper diam. Praesent non velit lectus. Proin vehicula ut metus non tempor. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae.', 'Quisque in interdum tortor. Quisque ornare id massa a placerat. Nam orci lorem, pharetra a lacus feugiat, lacinia porta sem. Pellentesque viverra fringilla tincidunt. Etiam condimentum elementum metus, et lacinia justo condimentum non.' ]
h1 Responsive "pseudo" Masonry with CSS column
.intro
  p Browser compatibility, see 
    a(href='http://caniuse.com/#feat=multicolumn' target='_blank') Can I Use
    | .
.wrapper
  .masonry
    - for (var i = 0; i < items.length; i++)
      div
        p= items[i]
//
  |        OxxO
  |       X oo X
  |       X >< X
  |        XXXX~<>
  |      (..)(..)
              
            
!

CSS

              
                // Technical restriction: impossibility of disposing items horizontally

_gap = 1.5rem
_sizeXS = 36.01rem
_sizeS  = 65.01rem
_sizeL  = 90.01rem

.masonry
  margin _gap 0
  column-gap _gap

@media (min-width _sizeXS)
  .masonry
    column-count 2

@media (min-width _sizeS)
  .masonry
    column-count 3

@media (min-width _sizeL)
  .masonry
    column-count 4

.masonry > *
  display inline-block
  width 100%
  margin 0 0 _gap
  padding 0 1em
  box-sizing border-box

// For demo :

body
  margin 1em
  line-height 1.67
  //font-size 1em
  font-family 'Open Sans', Arial, Sans-serif
  color tan
  background #333

.wrapper
  max-width 90rem
  margin 3em auto

a
  text-decoration none
  color peru

a:focus
a:hover
a:active
  text-decoration underline

h1
.intro p
  text-align center

.masonry > *
  color #333
  background-color tan
  //background-image linear-gradient(135deg, rgba(255, 255, 255, .2), rgba(0, 0, 0, .2))
  transition background-color .3s ease-in-out
  border-radius .3rem

.masonry > :hover
  background-color peru

//.masonry > p
//  counter-reset div

.masonry > *
  counter-increment div

.masonry > * p:first-child::before
  display inline
  content counter(div) '/ '

              
            
!

JS

              
                // No js
              
            
!
999px

Console