MAKE LOVR ENVELOPE ✉️ WITH LETTER TO IMPRESS YOUR CRUSH 😍

AYUSH KUSHWAHA
1


In This Blog I am going to tell you about,how make a envelope✉️ and a letter to impress your crush😍.

Before starting You must have a knowledge of


   

  BASIC HTML

  BASIC CSS

  BASIC JAVASCRIPT

   

 

Then only you can understand the code clearly.


LET GET STARTED

Now,open your code editor and make a new project.

  • index.html
  • script.js
  • style.css


    

 

  

<!DOCTYPE html>

<html lang="en">

<head>

    <meta charset="UTF-8">

    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <title>Envelope</title>

<link rel="stylesheet" href="style.css" type="text/css" media="all" />

</head>

<body>

    <div class="envelope-container" onclick="toggleLetter()">

        <div class="envelope">

            <span class="heart">❤</span>

            <div class="flap"></div>

        </div>

        <div class="letter">

            <p>Dear Love,<br> You are my heart's sweetest melody!<br>💖</p>

        </div>

    </div>

<script src="script.js" type="text/javascript" charset="utf-8"></script>

</body>

</html>

  

    

    

    

    

  
Now,make a new file script. js.

    

      

  function toggleLetter() {

      let envelope = document.querySelector('.envelope-container');

      envelope.classList.toggle('opened');

      createHearts();

  }

  function createHearts() {

      for (let i = 0; i < 10; i++) {

          let heart = document.createElement('div');

          heart.innerHTML = '💝';

          heart.classList.add('heart-animation');

          heart.style.left = `${Math.random() * 100}%`;

          heart.style.animationDelay = `${Math.random() * 0.1}s`;

          document.body.appendChild(heart);

          setTimeout(() => heart.remove(), 1500);

      }

  }

    

  

style.css


    

        * {

            margin: 0;

            padding: 0;

            box-sizing: border-box;

            font-family: 'Courier New', Courier, monospace;

        }

        body {

            display: flex;

            justify-content: center;

            align-items: center;

            height: 100vh;

            background: linear-gradient(135deg, #ff758c, #ff7eb3);

            overflow: hidden;

        }

        .envelope-container {

            position: relative;

            width: 320px;

            height: 220px;

            perspective: 1000px;

            cursor: pointer;

        }

        .envelope {

            position: relative;

            width: 100%;

            height: 100%;

            background: #ff4d6d;

            border-radius: 10px;

            box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);

            overflow: hidden;

            display: flex;

            justify-content: center;

            align-items: center;

        }

        .flap {

            position: absolute;

            top: 0;

            left: 0;

            width: 100%;

            height: 50%;

            background: #d43f5e;

            clip-path: polygon(0% 0%, 100% 0%, 50% 100%);

            transition: transform 0.5s ease-in-out;

            transform-origin: top;

        }

        .letter {

            position: absolute;

            top: 30%;

            left: 50%;

            width: 90%;

            height: 70%;

            background: #fff;

            transform: translate(-50%, 0%) scale(0.9);

            transition: top 0.7s ease-in-out 0.3s;

            padding: 15px;

            text-align: center;

            border-radius: 5px;

            box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);

            z-index: -1;

            font-size: 16px;

            color: #d43f5e;

            font-weight: bold;

            border: 2px solid #ff4d6d;

        }

        .letter p {

            font-size: 18px;

            line-height: 1.5;

        }

        .opened .flap {

            transform: rotateX(180deg);

        }

        .opened .letter {

            top: -60%;

        }

        .heart {

            position: absolute;

            top: 10px;

            left: 50%;

            transform: translateX(-50%);

            font-size: 24px;

            color: white;

        }

        .heart-animation {

            position: absolute;

            bottom: 0;

            left: 50%;

            transform: translateX(-50%);

            font-size: 30px;

            color: #ff0000;

            opacity: 0;

            animation: floatUp 1.5s ease-in-out forwards;

        }

        @keyframes floatUp {

            0% {

                bottom: 0;

                opacity: 1;

            }

            100% {

                bottom: 100px;

                opacity: 0;

            }

        }

    

  

you compeleted your envelope,happy learning.

Post a Comment

1Comments

Post a Comment