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

              
                <h1>Masonry design with CSS Multicolumns</h1>
<section class="container">
  <div><img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/9425/chuck-norris-360.jpg" alt="">Lorem Elsass ipsum réchime amet non Choucroute knack hopla.</div>
	<div>Wotch a kofee avec ton BibalaekaesSalat et ta wurscht ?</div>
	<div>Yeuh non che suis au réchime, je ne mange plus que des Grumbeere light et che fais de la chym avec Chulien. Tiens, un Picon sur le comptoir.</div>
	<div>Allez tchao bissame, dû KNACSS !</div>
	<div>Lorem Elsass ipsum réchime amet non Choucroute knack hopla.</div>
  <div>Flammekueche !</div>
	<div><img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/9425/chuck-norris-360.jpg" alt=""> Wotch a kofee avec ta wurscht ?</div>
	<div>Yeuh non che suis au réchime, je ne mange plus que des Grumbeere light et che fais de la chym avec Chulien. Tiens, un Picon sur le comptoir.</div>
  <div>Lorem Elsass ipsum réchime amet non Choucroute knack hopla.</div>
	<div>Wotch a kofee avec ton BibalaekaesSalat</div>
  <div>Flammekueche !</div>
	<div>Yeuh non che suis au réchime, je ne mange plus que des Grumbeere light et che fais de la chym avec Chulien. Tiens, un Picon sur le comptoir. Yeuh non che suis au réchime. Tiens, un Picon sur le comptoir.</div>
  <div>Flammekueche !</div>
	<div>Allez tchao bissame, dû KNACSS !</div>
	<div>Lorem Elsass ipsum réchime amet non Choucroute knack hopla.</div>
	<div><img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/9425/chuck-norris-360.jpg" alt=""> Yeuh non che suis au réchime, je ne mange plus que des Grumbeere light et che fais de la chym avec Chulien. Tiens, un Picon sur le comptoir.</div>
</section>

<ul>
  <li><a href="https://caniuse.com/#feat=multicolumn">CSS Multicolumn support</a></li>
</ul>
              
            
!

CSS

              
                /* Multicolumns and breaks handling */

@media (min-width: 576px) {
  .container {
    columns: 3;
  }
}
@media (min-width: 1024px) {
  .container {
    columns: 4;
  }
}


.container > * {
  -webkit-column-break-inside: avoid; /* WebKit fix */
  page-break-inside: avoid; /* Firefox fix */
  break-inside: avoid-column; /* W3C */
  word-wrap: break-word;
}


/* Reset */

html {
  font-size: 62.5%;
  box-sizing: border-box;
}
* {
  box-sizing: inherit;
}
body {
	margin: 2rem;
	background: #fff;
	font-family: system-ui, arial, sans-serif;
	font-size: 1.8rem;
  line-height: 1.5;
}
img {
  max-width: 100%;
  height: auto;
}

/* Counter */
div {
  counter-increment: number;
}
div::before {
  content: counter(number) "-";
  font-weight: bold;
  display: block;
}

// beauty of Sass :) 
$colors: orange, hotpink, olivedrab, chocolate, cadetblue, slategray, darkmagenta, tomato, teal;

@each $item in $colors {
  $i: index($colors, $item);
  $len: length($colors);
  div:nth-child(#{$len}n+#{$i}) {
    padding: 1rem;
    color: #fff;
    margin-bottom: 1rem;
    background: $item;
  }
}
              
            
!

JS

              
                
              
            
!
999px

Console