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.

            
              <body class="bg--blue">
  <a href="https://github.com/jh3y/driveway"><img style="position: absolute; top: 0; right: 0; border: 0; z-index: 9999;" src="https://camo.githubusercontent.com/38ef81f8aca64bb9a64448d0d70f1308ef5341ab/68747470733a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f72696768745f6461726b626c75655f3132313632312e706e67" alt="Fork me on GitHub" data-canonical-src="https://s3.amazonaws.com/github/ribbons/forkme_right_darkblue_121621.png"></a>
  <div class="dw">
    <div class="dw-pnl dw-pnl--fcs">
      <div class="dw-pnl__cntnt bd--white tx--white">
        <h1>Pure CSS masonry layout</h1>
      </div>
    </div>
    <div class="dw-pnl">
      <div class="dw-pnl__cntnt bd--white tx--white">
        <ul>
          <li>Configurable</li>
          <li>Responsive</li>
          <li>Supports clusters</li>
        </ul>
      </div>
    </div>
    <div class="dw-pnl "><img src="https://unsplash.it/419/?random" class="dw-pnl__cntnt"/>
    </div>
    <div class="dw-pnl ">
      <div class="dw-pnl__cntnt tx--white bd--white">
        <p>Phasellus malesuada, urna non auctor viverra, libero ex pellentesque urna, id rhoncus eros lacus tristique risus. Interdum et malesuada fames ac ante ipsum primis in faucibus.</p>
      </div>
    </div>
    <div class="dw-pnl ">
      <img src="https://unsplash.it/445/?random" class="dw-pnl__cntnt"/>
    </div>
    <div class="dw-pnl ">
      <img src="https://unsplash.it/423/?random" class="dw-pnl__cntnt"/>
    </div>
    <div class="dw-pnl dw-clstr dw-clstr--hrz">
      <div class="dw-clstr__sgmnt dw-clstr__sgmnt--rw ">
        <div class="dw-pnl dw-clstr__sgmnt ">
          <div class="dw-pnl__cntnt bd--white tx--white">
            <h2>How</h2>
          </div>
        </div>
      </div>
      <div class="dw-clstr__sgmnt dw-clstr__sgmnt--rw ">
        <div class="dw-pnl dw-clstr__sgmnt ">
          <div class="dw-pnl__cntnt bd--white tx--white">
            <h2>about</h2>
          </div>
        </div>
        <div class="dw-pnl dw-clstr__sgmnt ">
          <div class="dw-pnl__cntnt bd--white tx--white">
            <h2>clusters?</h2>
          </div>
        </div>
      </div>
    </div>
    <div class="dw-pnl ">
      <img src="https://unsplash.it/420/?random" class="dw-pnl__cntnt"/>
    </div>
    <div style="height: 200px;" class="dw-pnl dw-flp">
      <div class="dw-pnl__cntnt dw-flp__cntnt">
        <div class="dw-flp__pnl dw-flp__pnl--frnt tx--white bd--white tx--center">
          <h1>You can flip me round</h1>
        </div>
        <div class="dw-flp__pnl dw-flp__pnl--bck bd--white tx--white tx--center">
          <h1>Yeah that's right</h1>
        </div>
      </div>
    </div>
    <div class="dw-pnl dw-clstr dw-clstr--vrt">
      <div class="dw-clstr__sgmnt dw-clstr__sgmnt--clmn ">
        <div class="dw-pnl dw-clstr__sgmnt ">
          <div class="dw-pnl__cntnt bd--white tx--white">
            <h2>A</h2>
          </div>
        </div>
      </div>
      <div class="dw-clstr__sgmnt dw-clstr__sgmnt--clmn ">
        <div class="dw-pnl dw-clstr__sgmnt ">
          <div class="dw-pnl__cntnt bd--white tx--white">
            <h2>vertically</h2>
          </div>
        </div>
        <div class="dw-pnl dw-clstr__sgmnt ">
          <div class="dw-pnl__cntnt bd--white tx--white">
            <h2>flowed</h2>
          </div>
        </div>
        <div class="dw-pnl dw-clstr__sgmnt ">
          <div class="dw-pnl__cntnt bd--white tx--white">
            <h2>cluster</h2>
          </div>
        </div>
      </div>
    </div>
    <div class="dw-pnl "><img src="https://unsplash.it/424/?random" class="dw-pnl__cntnt"/>
    </div>
    <div class="dw-pnl ">
      <div class="dw-pnl__cntnt bd--white bg--darkred tx--white">
        <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis eu justo ex. Praesent mollis augue sagittis eros pharetra feugiat. Phasellus dignissim est lacus. Sed nec imperdiet dolor, sit amet mattis ex. Sed sed augue eu neque tristique commodo. Mauris aliquet tortor sollicitudin nibh molestie, id egestas nisl sollicitudin. Aliquam erat volutpat. Donec quis ultrices ligula. Cras sed purus risus. Curabitur quis eros eu tortor semper eleifend. Pellentesque lorem elit, dignissim interdum massa id, malesuada rutrum ligula. Suspendisse tempor quis mauris eu facilisis. Phasellus non volutpat diam, non dapibus ligula. Ut non molestie ex, nec sagittis mi. Curabitur suscipit tellus id dolor pretium blandit. Cras tristique tristique pharetra.</p>
      </div>
    </div>
    <div class="dw-pnl "><img src="https://unsplash.it/425/?random" class="dw-pnl__cntnt"/>
    </div>
    <div class="dw-pnl dw-pnl--fcs">
      <div class="dw-pnl__cntnt tx--white bd--white tx--center">
        <h1>Focus on hover</h1>
      </div>
    </div>
    <div class="dw-pnl ">
      <div class="dw-pnl__cntnt tx--white bd--white">
        <h2>Title for some content</h2>
        <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis eu justo ex. Praesent mollis augue sagittis eros pharetra feugiat. Phasellus dignissim est lacus. Sed nec imperdiet dolor, sit amet mattis ex. Sed sed augue eu neque tristique commodo. Mauris aliquet tortor sollicitudin nibh molestie, id egestas nisl sollicitudin. Aliquam erat volutpat. Donec quis ultrices ligula. Cras sed purus risus. Curabitur quis eros eu tortor semper eleifend.</p>
      </div>
    </div>
    <div class="dw-pnl dw-pnl--pls">
      <div class="dw-pnl__cntnt tx--white bd--white bg--darkred tx--center">
        <h1>Pulse on hover</h1>
      </div>
    </div>
    <div class="dw-pnl "><img src="https://unsplash.it/440/?random" class="dw-pnl__cntnt"/>
    </div>
    <div class="dw__fcs-crtn"></div>
  </div>
</body>
            
          
!
            
              .dw
  animation fade 2s
  
@keyframes fade
  from
    opacity 0
  to
    opacity 1

config = {
  "responses": {
    "breakpoints": {
      "sm": "430px",
      "md": "768px",
      "lg": "992px",
      "xl": "1500px"
    },
    "cols": {
      "sm": 1,
      "md": 2,
      "lg": 3,
      "xl": 4
    },
    "collapse": "sm"
  },
  "features": {
    "focus": true,
    "flip": true,
    "pulse": true
  },
  "aesthetics": {
    "panelGap": "5px",
    "panelPadding": "20px",
    "borderRadius": "10px",
    "flipSizes": {
      "sm": "200px",
      "md": "300px",
      "lg": "400px"
    }
  },
  "blocks": {
    "layout": {
      "lbl": "dw",
      "els": {
        "focus-curtain": "fcs-crtn"
      }
    },
    "panel": {
      "lbl": "dw-pnl",
      "els": {
        "content": "cntnt"
      }
    },
    "flip": {
      "lbl": "dw-flp",
      "els": {
        "panel": "pnl",
        "content": "cntnt"
      }
    },
    "cluster": {
      "lbl": "dw-clstr",
      "els": {
        "segment": "sgmnt"
      }
    }
  },
  "mods": {
    "cluster": "clstr",
    "segment": "sgmnt",
    "small": "sm",
    "medium": "md",
    "large": "lg",
    "vertical": "vrt",
    "horizontal": "hrz",
    "quarter": "qrt",
    "half": "hlf",
    "flip": "flp",
    "front": "frnt",
    "back": "bck",
    "focus": "fcs",
    "pulse": "pls",
    "column": "clmn",
    "row": "rw"
  }
}

// BEM mixins.
el(elName)
  define('content', lookup(elName))
  &__{elName}
    {block}
    {content}

mod(modName)
  define('content', lookup(modName))
  &--{modName}
    {block}
    {content}

// create shortcuts
$blocks     = config.blocks
$mods       = config.mods
$responses  = config.responses
$aesthetics = config.aesthetics

define('$clusterCollapse', unquote($responses.breakpoints[$responses.collapse]))

// generate aesthetic variables based on config
for $aesthetic, $value in $aesthetics
  if $aesthetic != 'flipSizes'
    define('$value', unquote($value))
  define('$' + $aesthetic, $value)

// generate feature flags
for $feature, $enabled in config.features
  define('$' + $feature, $enabled)

// layout container block
.{$blocks.layout.lbl}
  box-sizing border-box
  column-gap 0
  position   relative

  *
    box-sizing border-box

  if $focus
    +el($blocks.layout.els.focus-curtain)
      background-color black
      bottom           0
      display          none
      left             0
      opacity          .75
      position         fixed
      right            0
      top              0
      z-index          2

  // generate column-count for different breakpoints as dictated by config
  for $breakpoint, $value in $responses.breakpoints
    define('$columnCount', $responses.cols[$breakpoint])
    define('$breakpointVal', unquote($value))
    if $columnCount != 1
      @media(min-width: $breakpointVal)

        // NOTE: space required to please linter.
        column-count $columnCount

// panel block
.{$blocks.panel.lbl}
  margin 0
  padding $panelGap

  if $focus
    +mod($mods.focus)
      position relative

      &:hover
        z-index  3

      // use CSS3 sibling combinator syntax to show focus curtain when a focus
      // panel is hovered over
      &:hover ~ .{$blocks.layout.lbl}__{$blocks.layout.els.focus-curtain}
        display block

  if $pulse
    +mod($mods.pulse)
      transform-style preserve-3d
      perspective     1000
      transition      transform .25s ease 0s
      &:hover
        transform scale(1.02)

  +el($blocks.panel.els.content)
    border-radius $borderRadius
    overflow      hidden
    padding       $panelPadding
    width         100%

// NOTE: Iterates through responsive breakpoints in order to set break-inside
// property on the smallest possible breakpoint where columns > 1
$set = true
for $breakpoint, $value in $responses.breakpoints
  define('$columnCount', $responses.cols[$breakpoint])
  define('$breakpointVal', unquote($value))

  if $columnCount != 1
    if $set
      $set = false
      .{$blocks.panel.lbl}
        @media (min-width: $breakpointVal)
          break-inside avoid

if $flip
  .{$blocks.flip.lbl}
    perspective 1000

    &:hover
      .{$blocks.flip.lbl}__{$blocks.flip.els.content}
        transform rotateY(180deg)

    // NOTE: generates flip panel sizes.
    // important as flip panel must have a defined height in order to render
    // properly.
    for $size, $value in $flipSizes
      define('$heightVal', unquote($value))

      +mod($size)
        height $heightVal

    +el($blocks.flip.els.panel)
      backface-visibility hidden
      border-radius       $borderRadius
      height              100%
      left                0
      overflow            visible
      padding             $panelPadding
      position            absolute
      top                 0
      width               100%

      +mod($mods.front)
        transform rotateY(0deg)
        z-index   2

      +mod($mods.back)
        transform rotateY(180deg)

    +el($blocks.flip.els.content)
      height          100%
      overflow        visible
      position        relative
      transform-style preserve-3d
      transition      .25s

.{$blocks.cluster.lbl}
  display flex
  padding 0

  +mod($mods.vertical)
    @media(max-width: $clusterCollapse)
      flex-direction column

  +mod($mods.horizontal)
    flex-direction column

  +el($blocks.cluster.els.segment)
    display flex
    flex    1 1 auto

    +mod($mods.row)
      display        flex

      @media(max-width: $clusterCollapse)
        flex-direction column

    +mod($mods.column)
      flex-direction column

    @media(min-width: $clusterCollapse)
      +mod($mods.half)
        flex-basis 50%

      +mod($mods.quarter)
        flex-basis 25%
        
        
/**
  * Theming
*/
$black   = #000
$red     = #e74c3c
$green   = #26a65b
$grey    = #6c7a89
$purple  = #8e44ad
$blue    = #1e8bc3
$white   = #ecf0f1
$darkred = #cf000f

$colorPallette = {
  black  : $black
  red    : $red
  blue   : $blue
  green  : $green
  grey   : $grey
  purple : $purple
  white  : $white
}

*
  box-sizing border-box

for alignment in left right center
  .tx--{alignment}
    text-align alignment


body
  font-family 'Open Sans', sans-serif

h3
  margin-top   0

/**
* Colors
*/
for color, value in $colorPallette
  .bd--{color}
    border           4px solid value

  .bg--{color}
    background-color value

  .tx--{color}
    color            value

$blocks   = config.blocks

/**
* Images
*/
img
  max-height 300px

  &.{$blocks.panel.lbl}__{$blocks.panel.els.content}
  &.{$blocks.flip.lbl}__{$blocks.flip.els.panel}
    padding 0

  &.{$blocks.flip.lbl}__{$blocks.flip.els.panel}
    max-height 100%
            
          
!
999px
🕑 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.

Console