Birthday wishes using HTML, CSS & JavaScript
How to Make a Birthday Card with HTML and CSS
Create an HTML file named ‘index.html‘ and put those codes given below
!DOCTYPE html>
<html>
<head>
<title>Happy Birthday Wishing - Chamaparan Now </title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- Google Fonts -->
<link href="https://fonts.googleapis.com/css?family=Pacifico&display=swap" rel="stylesheet">
<!-- My Stylesheet -->
<link rel="stylesheet" href="style.css">
</head>
<body>
<div class="wish">
Happy Birthday
</div>
<div class="cake">
<div class="plate"></div>
<div class="layer"></div>
<div class="icing">
<div class="name">
<p>Happy Birthday <br/> <span id="name">Name</span></p>
</div>
</div>
<div class="candle1">
<div class="flame1"></div>
</div>
<div class="candle2">
<div class="flame2"></div>
</div>
<div class="candle3">
<div class="flame3"></div>
</div>
<div class="candle4">
<div class="flame4"></div>
</div>
<div class="candle5">
<div class="flame5"></div>
</div>
</div>
<div class ="text">May all your dreams come true and May God crown you with all the success in life. Wishing you many returns of this day. Happy birthday! From, Your Name
</div>
<audio id="HBD" loop>
<source src="https://dl.dropbox.com/s/57hjcyz47o4us25/audio.mp3">
</audio>
<!-- JavaScript Page -->
<script src="function.js" type="text/javascript"></script>
</body>
style.css
Create a CSS file named ‘style.css‘ and put those codes given below.
body {
background-image: url("https://dl.dropbox.com/s/4ubs90vu8bn5zq2/image.gif");
}
.wish {
margin: 0;
padding: 0;
position: absolute;
top: 4%;
width: 100%;
text-align: center;
font-size: 3em;
color: red;
letter-spacing: 0.1em;
font-family: 'Pacifico', cursive;
background: -webkit-linear-gradient(#ffff00, #ff1493);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
-webkit-animation: hue 3s infinite ease-in-out;
}
@-webkit-keyframes hue {
0% {
-webkit-filter: hue-rotate(0deg);
transform: scale(1) rotate(0deg);
}
50% {
-webkit-filter: hue-rotate(360deg);
transform: scale(1.2) rotate(5deg);
}
}
.cake {
position: absolute;
width: 250px;
height: 200px;
top: 50%;
left: 50%;
margin-top: -70px;
margin-left: -125px;
}
.plate {
position: absolute;
width: 290px;
height: 130px;
bottom: -10px;
left: -15px;
background-color: #ccc;
border-radius: 25%;
box-shadow: 0 5px 0 0 #000;
}
.cake>* {
position: absolute;
}
.layer {
position: absolute;
display: block;
width: 250px;
height: 100px;
border-radius: 25%;
background-color: #2a0a0a;
border: 3px solid #fff;
box-shadow:
0 15px 0 0 #2a0a0a,
0 30px 0 0 #2a0a0a,
0 33px 0 0 #fff,
0 45px 0 0 #2a0a0a,
0 60px 0 0 #2a0a0a,
0 63px 0 0 #fff,
0 75px 0 0 #2a0a0a,
0 90px 0 0 #2a0a0a;
}
.icing {
top: 3px;
left: 3px;
background-color: #fff;
border: 5px dotted #2a0a0a;
width: 240px;
height: 90px;
border-radius: 25%;
}
.name {
margin: 0;
padding: 0;
position: absolute;
top: 10%;
width: 100%;
text-align: center;
font-size: 1em;
color: #2a0a0a;
font-family: 'Pacifico', cursive;
}
.candle1 {
z-index: 10;
width: 10px;
height: 50px;
background-color: #fe2e2e;
border-radius: 4px;
top: -25px;
left: 50%;
margin-left: -8px;
}
.flame1 {
border-bottom-left-radius: 45% 35%;
border-bottom-right-radius: 45% 35%;
box-shadow: 0 -15px 2px 2px #ffc205;
background-color: yellow;
border-radius: 50%;
height: 30px;
width: 5px;
top: -30px;
left: 30%;
position: absolute;
}
.candle2 {
z-index: 10;
width: 10px;
height: 50px;
background-color: #fe2e2e;
border-radius: 4px;
top: -25px;
left: 80%;
margin-left: -8px;
}
.flame2 {
border-bottom-left-radius: 45% 35%;
border-bottom-right-radius: 45% 35%;
box-shadow: 0 -15px 2px 2px #ffc205;
background-color: yellow;
border-radius: 50%;
height: 30px;
width: 5px;
top: -30px;
left: 30%;
position: absolute;
}
.candle3 {
z-index: 10;
width: 10px;
height: 50px;
background-color: #fe2e2e;
border-radius: 4px;
top: -25px;
left: 20%;
margin-left: -8px;
}
.flame3 {
border-bottom-left-radius: 45% 35%;
border-bottom-right-radius: 45% 35%;
box-shadow: 0 -15px 2px 2px #ffc205;
background-color: yellow;
border-radius: 50%;
height: 30px;
width: 5px;
top: -30px;
left: 30%;
position: absolute;
}
.candle4 {
z-index: 10;
width: 10px;
height: 50px;
background-color: #fe2e2e;
border-radius: 4px;
top: 15px;
left: 15%;
margin-left: -8px;
}
.flame4 {
border-bottom-left-radius: 45% 35%;
border-bottom-right-radius: 45% 35%;
box-shadow: 0 -15px 2px 2px #ffc205;
background-color: yellow;
border-radius: 50%;
height: 30px;
width: 5px;
top: -30px;
left: 30%;
position: absolute;
}
.candle5 {
z-index: 10;
width: 10px;
height: 50px;
background-color: #fe2e2e;
border-radius: 4px;
top: 15px;
left: 85%;
margin-left: -8px;
}
.flame5 {
border-bottom-left-radius: 45% 35%;
border-bottom-right-radius: 45% 35%;
box-shadow: 0 -15px 2px 2px #ffc205;
background-color: yellow;
border-radius: 50%;
height: 30px;
width: 5px;
top: -30px;
left: 30%;
position: absolute;
}
.text {
margin: 0;
padding: 0;
position: absolute;
top: 80%;
width: 100%;
text-align: center;
font-size: 1em;
color: white;
font-family: 'Pacifico', cursive;
}
function.js
Create a JavaScript file named ‘function.js‘ and put those codes given below.
alert(“TOUCH THE CAKE 🎂 AND ENJOY THE PARTY 🎶🎉🎊”);
window.addEventListener(‘click’, function() {
var audio = document.getElementById(“HBD”);
audio.play();
});
One Reply to “Birthday wishes using HTML, CSS & JavaScript”