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. 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

JavaScript

Babel is required to process package imports. If you need a different preprocessor remove all packages first.

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

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 Tap on envelope to view card inside
.wrapper
  - for(var n=0; n<100; n++)
    details 
      summary.envelope
      p.card 


              
            
!

CSS

              
                $bg: #f3e0d4;
$lb: #fffefc;
$colors: #91b27b, #01ABCE, #FFCA08, #F7941D, #ED008C,#5C2E91;
$emojis: '👻', '😺', '🦄', '🤖', '🐍', '🥳', '🤠', '😈', '🎊';


* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  position: relative;
}

*::before,
*::after {
  content: "";
  display: block;
  position: absolute;
}
h1{
  font-size: 1.25rem;
  text-align: center;
  padding: 6vh;
  font-family: 'Poppins', sans-serif;
  font-weight:500;
}
body {
  background: $bg;
  .wrapper {
    width: 100%;
    margin:auto;
    padding: 8%;
    display: grid;
    grid-template-columns: repeat(auto-fit,minmax(6.5rem, 1fr));
    grid-auto-rows: 3rem;
    grid-row-gap: 3rem;  
   
  }
}

.envelope {
  list-style: none;
  width: 6rem;
  height: 4rem;
  background: blue;  
  
  &::before{
  width: 6rem;
  height: 2.4rem;
  top:0;
  left: 0;  
  transform-origin: 0% 0%;
  transition: all 0.5s ease-out;
  }
}

.card {
 width: 5rem;
  height: 1rem;  
  left: 0.5rem;
  bottom:3rem; 
  
  &::after{    
    width: 3rem;
    height: 1.6rem;
    background: $lb;
    bottom: 1rem;
    left: 1rem;
    transition: all 3s;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding-top: 0.2em;
    font-size: 1.25rem;
    
    }
  &::before{    
      height:0rem;
      width: 6rem;  
      left: -0.5rem;
      bottom:-2rem;
      z-index: 2;  
      //display:none;
   }
  
}


details[open]{ 
  .envelope{
      &::before{
        transform: rotateX(180deg);
      }
    }
  .card{
    &::after{
      animation: open 1.5s ease-in-out;
    }
    &::before{
      
      animation: disappear .8s ease-in-out;
    }
  }
  
}
@for $i from 1 through length($colors){
  details:nth-of-type(#{length($colors)}n+#{$i}){
    $main: nth($colors, $i);
    
    .envelope{
      background: 
    linear-gradient(transparent 1%,darken($main,15%) 2%, transparent 5%),
    linear-gradient(-147deg,darken($main,10%) 50%,  transparent 40%)no-repeat 0 0 / 3rem 2rem,
    linear-gradient(147deg,darken($main,10%) 50%,  transparent 40%)no-repeat 3rem 0 / 3rem 2rem,
    linear-gradient(-33deg,$main 67%, darken($main,10%) 68% 69%, transparent 69%)no-repeat 0 2rem / 3rem 4rem,
    linear-gradient(33deg,$main 67%, darken($main,10%) 68% 69%, transparent 69%)no-repeat 3rem 2rem / 3rem 4rem,
    linear-gradient(-33deg, $main 50%, transparent 52%),
    linear-gradient(33deg, $main 50%, transparent 52%); 
      
      &::before{
      background: linear-gradient(33deg, transparent 50%, darken($main,10%) 50%)0 0/ 3rem 2.4rem,
    linear-gradient(-33deg, transparent 50%, darken($main,10%) 50%)3rem 0/ 3rem 2.4rem;
      background-repeat: no-repeat;
    }
    }
    
    .card{
      background: 
    linear-gradient(33deg, $main 38%, transparent 39%),
    linear-gradient(-33deg, transparent 38%, $lb 39%);
      
      &::before{
        background:    
    linear-gradient(-33deg,$main 67%, darken($main,10%) 68% 69%, transparent 69%)no-repeat 0 2rem / 3rem 4rem,
    linear-gradient(33deg,$main 67%, darken($main,10%) 68% 69%, transparent 69%)no-repeat 3rem 2rem / 3rem 4rem,
    linear-gradient(-33deg, $main 50%, transparent 52%),
    linear-gradient(33deg, $main 50%, transparent 52%);
      }
    }
       
    
    
  }
}


@for $i from 1 through 100{
  details:nth-of-type(#{$i}){
    transform: rotate(1deg*(random(120)-60));
    .card::after{
      content: nth($emojis, random(length($emojis)))
    }
  }
}

@keyframes open {
  0%    {height:0;  }
  100%  {height: 1.6rem;}
}
@keyframes disappear {
  0%    {height:4em;}
  80%   {height:4em; opacity:1}
  90%   {height:4em; opacity:0}
  100% {height:0}
}

.envelope::-webkit-details-marker {
  display: none
}
.envelope:focus{
  outline: thin dotted;
}
              
            
!

JS

              
                
              
            
!
999px

Console