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

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

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

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

Code Indentation


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.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

    .mondrian__block(v-for="block in blocks", :data-row-span="block.rowSpan", :data-col-span="block.colSpan", :data-color-index="block.colorIndex")
  button.generate-button(v-on:click='regenerate') Regenerate
              @import url('https://fonts.googleapis.com/css?family=Lato:300,900')

$mondrian-black = rgb(7, 9, 8)
$mondrian-yellow = rgb(248, 217, 45)
$mondrian-white = rgb(242, 245, 241)
$mondrian-blue = rgb(11, 84, 164)
$mondrian-red = rgb(214, 0, 20)

$colors = $mondrian-white $mondrian-yellow $mondrian-white $mondrian-blue $mondrian-white $mondrian-red

$blockSize = 50px
$height = 6 * $blockSize
$width = 5 * $blockSize

  box-sizing border-box
  animation  fadeIn .5s

  background-color #fff
  display grid
  align-items center
  justify-content center
  font-family 'Lato', sans-serif
  text-align       center
  padding 20px
  min-height 100vh
  width 100vw

  background-color $mondrian-black
  border 10px solid $mondrian-black
  box-shadow 5px 10px 10px #aaa
  display grid
  grid-auto-columns $blockSize
  grid-auto-flow dense
  grid-auto-rows $blockSize
  grid-gap 10px
  grid-template-columns repeat(auto-fit, $blockSize)
  grid-template-rows repeat(auto-fit, $blockSize)
  height $height
  overflow hidden
  width $width

    animation scaleIn .25s ease 0s
    background-color $mondrian-white

    for $block in (1..10)
        animation-delay $block * 0.15s
        background-color $color
        transform scale(0)
        animation-fill-mode forwards

    for $modifier in (1..3)
        grid-row span $modifier
        grid-column span $modifier

    for $colorIndex in (1..6)
        background-color $colors[$colorIndex - 1]

  cursor pointer
  padding 4px 12px
  border-radius 4px
  font-family 'Lato', sans-serif
  margin-top 30px
  background-color #fff

    background-color darken(#fff, 10%)
    background-color darken(#fff, 20%)

@keyframes scaleIn
    transform scale(0)
    transform scale(1)

@keyframes fadeIn
    opacity 0
    opacity 1
              const app = new Vue({
  el: '#app',
  data: {
    blocks: [],
  methods: {
    generateBlocks: function() {
      for (let i = 0; i < 10; i++) {
          colSpan: Math.floor(Math.random() * 3 + 1),
          rowSpan: Math.floor(Math.random() * 3 + 1),
          colorIndex: Math.floor(Math.random() * 6 + 1),
    regenerate: function() {
      this.blocks = []
      setTimeout(() => this.generateBlocks(), 0)
  mounted: function () {

🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.