Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs 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 its URL and the proper URL extension.

+ 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

Auto Save

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 Made with <b>love</b> by <b>Orzoon</b>
p Use buttons to <strong>Open</strong> and <strong>Close</strong> the envelope
.all_container
 .container
  .envelope
  .flip
  .letter
    .text
 button#open open
 br
 button#close close
 hr
              
            
!

CSS

              
                body{
	background: linear-gradient(to right,#666666,#ecedfd);
	//background: #fff;
}
//shortcuts
$s: solid;
$a: absolute;
$tb:46px;
$lr:70px;
$br:6px;
//color variables
$left:#fa565a;
$right:#ed4c50;
$bottom:#fa565a;
$txt: #b0b0b0;
$top: #c94548;

.container,.envelope,.flip,.letter,.text,.text:before,.text:after{
	position: $a;
}
.container{
	position:relative;
	top:80px;
	margin:auto;
	height: 92px;
	width: 140px;
	background: #ddd;
	border-radius: $br;
	box-shadow: 0px 0px 3px #000;
  }
.envelope{
	border-top: $tb $s transparent;
	border-left: $lr $s $left;
	border-bottom: $tb $s $bottom;
	border-right: $lr $s $right;
	border-radius: $br;
	z-index:9;
  }
.flip{
	top:0;
	left:0;
	border-top: $tb $s $top;
	border-left: $lr $s transparent;
	border-bottom: $tb $s transparent;
	border-right: $lr $s transparent;
	border-radius: $br;
	z-index:6;
  }
.letter{
	top:0px;
	left:2px;
	height: 92px;
	width: 136px;
	background: #ddd;
	border-radius: $br;
	z-index:5;
	}
.text{
	top: 10px;
	left:12px;
	height:6px;
	width:100px;
	background: $txt;
  }
.text:before,.text:after{
	content:'';
	height:100%;
	background: $txt;
	left:0px;
	}
.text:before{
	top:10px;
	width: 50px;
	}
.text:after{
	top:20px;
	width:65px;
  }
/*Classes to be Added and removed*/
.open{
	animation: flipOpen .4s ease-in forwards ;
 }

.close{
	animation: flipClose .4s ease-in forwards;
 }

.letterOpen{
	top:-40px;
	transition: .3s ease-in;
 }

.letterClose{
	top: 0px;
	transition: .3s ease-in;
 }
//animations
@keyframes flipOpen{
	0%{
		transform: rotateX(0deg);
		transform-origin:center top;
	  }
	100%{
		transform:rotateX(180deg);
		transform-origin:center top;
	  }
  }
@keyframes flipClose{
	0%{
		transform: rotateX(180deg);
		transform-origin:center top;
	  }
	100%{
		transform:rotateX(0deg);
		transform-origin:center top;
	  }
  }
//buttons
button{
	color:#ddd;
	font-size:18px;
	font-weight: 600;
	text-transform: uppercase;
	width:100px;
	text-align:center;
	padding:10px;
	border-radius: 6px;
	border:none;
	letter-spacing: 1px;
	background: $right;
}
button:hover{
	cursor:pointer;
}
button:focus{
	outline: none;
	background: #ccc;
	color: #666;
	cursor: not-allowed;
}
#open{
	margin-top:-10px;
	margin-bottom: 8px;
}
#close{
	outline: none;
	background: #ccc;
	color: #ddd;
	cursor: not-allowed;
}
#open:focus ~ #close{
	cursor: pointer;
	background:$right;
}
//heaing
h1{
	font-size:25px;
	width: 400px;
	margin:0 auto;
	text-align:center;
	border-bottom: 3px solid #000;
	padding-bottom:10px;
	padding-top: 10px;
	}
p{
	font-size: 20px;
	font-weight: 400;
	text-align:center;
}
b:first-child{
	color:#E31B23;
	text-shadow: 0 0 3px #000;
}
b:last-child{
	color:blue;
	text-shadow: 0 0 2px #000;
}
hr{
width: 300px;
margin: 100px auto;
height: 4px;
background-color:#666;
border: 0px;
}

              
            
!

JS

              
                //variables
let flip = document.querySelector('.flip');
let letter = document.querySelector('.letter');
let btnOpen = document.querySelector('#open');
let btnClose = document.querySelector('#close');

//EventListner
btnOpen.addEventListener('click', open);
btnClose.addEventListener('click', close);

//open
function open(){
	flip.classList.add('open');
	flip.classList.remove('close');
	setTimeout(function(){
	letter.classList.add('letterOpen');
	letter.classList.remove('letterClose');
	letter.style.zIndex = '7';
	},400);
}

//close
function close(){
	letter.classList.remove('letterOpen');
	letter.classList.add('letterClose');
	setTimeout(function(){
		flip.classList.remove('open');
		flip.classList.add('close');
		letter.style.zIndex = '5';
	},300);
}
              
            
!
999px

Console