Skip to content

Instantly share code, notes, and snippets.

@Karlsebastian2525
Created February 4, 2025 10:32
Show Gist options
  • Save Karlsebastian2525/8f62c90c46591d5d93d8a27fdd935423 to your computer and use it in GitHub Desktop.
Save Karlsebastian2525/8f62c90c46591d5d93d8a27fdd935423 to your computer and use it in GitHub Desktop.
Untitled
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="index.css" rel="stylesheet">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.1/jquery.min.js"></script>
<title>Virtual Valentine's Day Card</title>
</head>
<body>
<div class="envelope-wrapper">
<div id="envelope" class="close">
<div class="front flap"></div>
<div class="front pocket"></div>
<div class="letter">
<p class="words line1">Hi Mae,</p>
<p class="words line2">This Valentine’s Day, I’d love to spend some special time with you, even if it’s virtual. Let’s make up soon and cherish every moment, even from a distance, until we can finally be together.</p>
<p class="words line3"> Love,<br><br>Baste</p>
</div>
<div class="hearts">
<div class="heart a1"></div>
<div class="heart a2"></div>
<div class="heart a3"></div>
</div>
</div>
</div>
<div class="reset">
<button id="open">YES</button>
<button id="reset">NO</button>
</div>
<h1 class="valentine">WILL YOU BE MY VALENTINE'S DATE?</h1>
<script src="index.js"></script>
</body>
</html>
$(document).ready(function() {
var envelope = $("#envelope");
var btn_open = $("#open");
var btn_reset = $("#reset");
envelope.click(function() {
open();
});
btn_open.click(function() {
open();
});
btn_reset.click(function() {
close();
});
function open() {
envelope.addClass("open")
.removeClass("close");
}
function close() {
envelope.addClass("close")
.removeClass("open");
}
})
body {
background-color: #E6A9EC;
}
.envelope-wrapper {
height: 380px;
}
#envelope {
position: relative;
height: 180px;
width: 280px;
border-bottom-left-radius: 6px;
border-bottom-right-radius: 6px;
margin-left: auto;
margin-right: auto;
top: 50%;
background-color: #F7CAC9;
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}
#envelope:hover {
cursor: pointer;
}
.front {
position: absolute;
width: 0;
height: 0;
z-index: 3;
}
.flap {
border-top: 98px solid #E6A4B4;
border-left: 140px solid transparent;
border-right: 140px solid transparent;
border-bottom: 82px solid transparent;
transform-origin: top;
}
.pocket {
border-left: 140px solid #F4E1C6;
border-right: 140px solid #F4E1C6;
border-bottom: 90px solid #F4E1C6;
border-top: 90px solid transparent;
border-bottom-left-radius: 6px;
border-bottom-right-radius: 6px;
}
.letter {
position: relative;
background-color: white;
width: 90%;
height: 95%;
top: 5%;
border-radius: 10px;
box-shadow: 0 2px 26px rgba(0, 0, 0, .12);
margin-left: auto;
margin-right: auto;
}
.letter:after {
content: "";
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
}
.words {
position: absolute;
left: 10%;
width: 80%;
height: 14%;
font-size: 15px;
font-family: Arial, Helvetica, sans-serif;
color: black;
}
.line1 {
top: 15%;
}
.line2 {
top: 30%;
}
.line3 {
top: 50%;
text-align: center;
}
.line4 {
top: 65%;
text-align: center;
}
.open .flap {
transform: rotatex(180deg);
transition: transform 0.4s ease, z-index 0.6s;
z-index: 1;
}
.close .flap {
transform: rotatex(0deg);
transition: transform 0.4s 0.6s ease, z-index 1s;
z-index: 5;
}
.open .letter {
transform: translatey(-80px);
transition: transform 0.4s 0.6s ease, z-index 0.6s;
z-index: 2;
}
.close .letter {
transform: translatey(0deg);
transition: transform 0.4s ease, z-index 1s;
z-index: 1;
}
.hearts {
position: absolute;
top: 90px;
left: 0;
right: 0;
z-index: 2;
}
.heart {
position: absolute;
bottom: 0;
right: 10%;
}
.heart:before, .heart:after {
position: absolute;
content: "";
background: #d00000;
width: 50px;
height: 80px;
left: 50px;
top: 0;
border-radius: 50px 50px 0 0;
transform: rotate(-45deg);
transform-origin: 0 100%;
}
.heart:after {
left: 0;
transform: rotate(45deg);
transform-origin: 100% 100%;
}
.close .heart {
opacity: 0;
animation: none;
}
.a1 {
left: 20%;
transform: scale(0.6);
opacity: 1;
animation: slideUp 4s linear 1, sideSway 2s ease-in-out 4 alternate;
animation-fill-mode: forwards;
animation-delay: 0.7s;
}
.a2 {
left: 55%;
transform: scale(1);
opacity: 1;
animation: slideUp 5s linear 1, sideSway 4s ease-in-out 2 alternate;
animation-fill-mode: forwards;
animation-delay: 0.7s;
}
.a3 {
left: 10%;
transform: scale(0.8);
opacity: 1;
animation: slideUp 7s linear 1, sideSway 2s ease-in-out 6 alternate;
animation-fill-mode: forwards;
animation-delay: 0.7s;
}
@keyframes slideUp {
0% {
top: 0;
}
100% {
top: -600px;
}
}
@keyframes sideSway {
0% {
margin-left: 0px;
}
100% {
margin-left: 50px;
}
}
.reset {
text-align: center;
}
.reset button {
font-weight: 800;
font-style: normal;
transition: all 0.1s linear;
background-color: transparent;
border: solid 2px #FF6863;
border-radius: 4px;
color: #FF6863;
display: inline-block;
font-size: 14px;
text-transform: uppercase;
margin: 20px;
margin-top: 100px;
padding: 10px;
line-height: 2em;
text-decoration: none;
min-width: 150px;
outline: none;
}
.reset button:hover {
background-color: #FF6863;
cursor: pointer;
color: white;
}
.valentine {
text-align: center;
font-family: Arial, Helvetica, sans-serif;
color:rgb(20, 20, 20);
font-size: 70px;
margin: 150px;
}
.words {
font-family: 'Dancing Script', cursive; /* Cursive Font */
font-size: 7.5px; /* Adjust size */
}
.valentine {
font-family: 'Great Vibes', cursive; /* Elegant Script Font */
font-size: 60px; /* Adjust as needed */
}
.reset button {
font-size: 14px; /* Reduced from 28px */
}
.line3 {
top: 60%; /* Adjusted for better spacing */
text-align: center;
}
.line4 {
top: 60%; /* Moves "Baste" further down */
text-align: center;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment