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. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ 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

              
                - const GRID_SIZE = 10
- const COUNT = Math.pow(GRID_SIZE, 2)
.flippy-snap
  - for(let f = 0; f < COUNT; f++)
    - const x = f % GRID_SIZE  
    - const y = Math.floor(f / GRID_SIZE)
    .flippy-snap__card.flippy-card(style=`--x: ${x}; --y: ${y};`)
      .flippy-card__front
      .flippy-card__rear
              
            
!

CSS

              
                *
  box-sizing border-box
  
body
  background hsl(120, 20%, 65%)
  display grid
  place-items center
  min-height 100vh
  
.flippy-snap
  --count 0
  height 50vmin
  width 50vmin
  display grid
  grid-template-columns repeat(var(--grid-size, 10), 1fr)
  grid-template-rows repeat(var(--grid-size, 10), 1fr)
  perspective 50vmin
  transform-style preserve-3d
    
.flippy-card
  --current-image url(https://images.unsplash.com/photo-1635964938310-3625a59ebf41?crop=entropy&cs=tinysrgb&fit=crop&fm=jpg&h=1000&ixid=MnwxfDB8MXxyYW5kb218MHx8fHx8fHx8MTYzNzAxMzQwMw&ixlib=rb-1.2.1&q=80&w=1000)
  --next-image url(https://images.unsplash.com/photo-1634918264609-8ed3af7be1ef?crop=entropy&cs=tinysrgb&fit=crop&fm=jpg&h=1000&ixid=MnwxfDB8MXxyYW5kb218MHx8fHx8fHx8MTYzNzAxMzU3NQ&ixlib=rb-1.2.1&q=80&w=1000)
  height 100%
  width 100%
  position relative
  transform rotateX(calc(var(--count) * -180deg))
  transition transform 0.5s
  transform-style preserve-3d

  &__front
  &__rear
    position absolute
    height 100%
    width 100%
    backface-visibility hidden
    -webkit-backface-visibility hidden
    background-image var(--current-image)
    background-position calc(var(--x, 0) * -100%) calc(var(--y, 0) * -100%)
    background-size calc(var(--grid-size, 10) * 100%)

  &__rear
    background-image var(--next-image)
    transform rotateY(180deg) rotate(180deg)
              
            
!

JS

              
                const SNAP = document.querySelector('.flippy-snap')
let count = 0
const UPDATE = () => SNAP.style.setProperty('--count', count++)
SNAP.addEventListener('click', UPDATE)
              
            
!
999px

Console