123

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.

            
              %form.board
  .card.card--assigned#card-assigned
  .slots
    - (0..23).each do |i|
      .slot
        %input.control(id="card-#{i}" type="checkbox")
        %label.card(class="card-#{i}" for="card-#{i}")
  %footer.footer
    %h1.title 
      Guess Who IRL 
      %small.subtitle 
        Interact with real people while on keyboard :v
    
    %button.btn--rematch#btn-rematch(type="reset")
      Rematch
            
          
!
            
              body 
  font-family: 'Avenir', sans-serif
  perspective: 1500px
  background-color: #345
  
@media (min-width: 0px)
  \:root 
    --board-width: 80vw
    --card-width: calc(var(--board-width) / 10.6)
    --card-height: calc(var(--board-width) / 7.4)
  .board
    width: var(--board-width)
    height: calc(var(--board-width) * .5625)
    padding: 30px 20px 50px
    transform: rotateX(30deg) translateX(10px)
    transform-style: preserve-3d
    box-shadow: 0px -20px 60px 10px rgba(0, 0, 0, .5)
    position: relative

    top: calc(var(--board-width) / 10)
    background-color: #ff5d3e
    border-radius: calc(var(--board-width) / 100)
    margin: auto

  .slots
    display: grid
    grid-template-columns: repeat(8, auto)
    grid-template-rows: repeat(3, auto)
    grid-gap: calc(var(--board-width) / 100)
    width: 100%
    height: 100%


  .slot
    border-radius: calc(var(--board-width) / 100) 
    box-shadow: inset 0px 5px 10px rgba(0, 0, 0, .2), 0px 2px 0px 1px #ff7036

  .card 
    display: block
    cursor: pointer
    margin: calc(var(--board-width) / 100) calc(var(--board-width) / 200)
    border-radius: calc(var(--board-width) / 200)
    background-color: #fff
    backface-visibility: visible
    position: relative
    padding: calc(var(--board-width) / 100) calc(var(--board-width) / 100) calc(var(--board-width) / 36) calc(var(--board-width) / 100)
    box-sizing: border-box
    top: calc(-100% + 10px)
    width: calc(100% - 10px)
    height: calc(100% - 10px)
    transform-origin: bottom left
    transform: rotateX(-45deg)
    transition: all .5s
    box-shadow: 0px -30px 50px rgba(0, 0, 0, .2)
    &:after
      content: ''
      display: block
      position: relative
      height: 100%
      background-image: url('http://ruidovisual.com/guess.jpg')
      background-size: calc(var(--board-width) / 2.13)
      transition: opacity .3s
    &--assigned
      position: absolute
      top: 80%
      width: calc(10% + 4px)
      height: calc(26.65% + 4px)
      left: 44%
      box-sizing: border-box
      border: 4px solid #a93a14

  .control
    position: absolute
    opacity: 0

  .control:checked ~ .card 
    transform: rotateX(-179deg)
    //box-shadow: 0 0 10px rgba(0, 0, 0, .2)
    box-shadow: none
    &:after
      opacity: 0

  $row: 0
  @for $i from 0 to 24
    @if $i % 5 == 0
      $row: $i/5

    .card-#{$i}:after 
      background-position: calc(var(--card-width) * -#{$i}) calc(var(--card-height) * -#{$row})

  .footer 
    display: flex
    justify-content: space-between

  .title 
    font-size: 1vw
    line-height: 1
    color: #d04f30
    text-shadow: 0px 1px 1px rgba(255, 255, 255, .4)

  .subtitle 
    font-weight: normal
    display: block

  .btn
    &--rematch
      // display: none
      background-color: #e65438
      border: none
      border-radius: 5px
      cursor: pointer
      color: #fff
      font-weight: bold
      font-family: 'Avenir', sans-serif
      text-transform: uppercase
      letter-spacing: 0.04em
      height: 25px
      padding: 0 10px
      margin-top: 10px
      transition: background-color .3s
      &:hover 
        background-color: darken(#e65438, 10)

@media (min-width: 1400px)
  \:root 
    --board-width: 1150px
  
  
            
          
!
            
              var cardAssigned = document.getElementById('card-assigned');
var btnRematch = document.getElementById('btn-rematch');

function getRand(limit){
  return Math.round(Math.random() * limit);
}


cardAssigned.className = 'card card--assigned card-' + getRand(24);

btnRematch.onclick = function(){
  cardAssigned.className = 'card card--assigned card-' + getRand(24);
}




            
          
!
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