520向你的crush表白吧~

 效果图大概是这样子

 因为爱心弹跳觉得太变态了就没让它动

520是可以变色的

背景是坠落粉色点点

非常简易

简单则美   保持smile :)

附代码:

<!DOCTYPE html>
<html>
<head>
    <title>I have a crush on you~</title>
    <style>
        body {
            height: 100vh;
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
            overflow: hidden;
        }
        
        .heart {
            width: 300px;
            height: 300px;
            background-color: red;
            position: relative;
            transform: rotate(-45deg);
            margin: 0 auto;
        }
        
        .heart::before,
        .heart::after {
            content: '';
            position: absolute;
            width: 300px;
            height: 300px;
            background-color: red;
        }
        
        .heart::before {
            border-radius: 200px 200px 0 0;
            top: -150px;
            left: 0;
        }
        
        .heart::after {
            border-radius: 200px 200px 200px 0;
            top: 0;
            left: 150px;
        }
        
        .text {
            text-align: center;
            font-size: 108px;
            margin-top: 50px;
            transform: translateY(50%);
            animation: colorChange 6s infinite;
        }
        
        .subtext {
            font-size: 108px;
        }
        
        @keyframes colorChange {
            0% {
                color: #ff0000; /* 红色 */
            }
            20% {
                color: #ff4500; /* 橙色 */
            }
            40% {
                color: #ffd700; /* 黄色 */
            }
            60% {
                color: #0000ff; /* 蓝色 */
            }
            80% {
                color: #8a2be2; /* 紫色 */
            }
            100% {
                color: #ff69b4; /* 浅粉色 */
            }
        }
        
        .bubble {
            position: absolute;
            width: 10px;
            height: 10px;
            background-color: pink;
            opacity: 0.8;
            border-radius: 50%;
            animation: bubbleFall 10s infinite;
        }
        
        @keyframes bubbleFall {
            0% {
                transform: translateY(0);
            }
            100% {
                transform: translateY(100vh);
            }
        }
    </style>
</head>
<body>
    <div class="heart"></div>
    <div class="text">520</div>
    <div class="subtext">I HAVE A CRUSH ON YOU</div>
    <script>
        for (let i = 0; i < 50; i++) {
            createBubble();
        }
        
        function createBubble() {
            const bubble = document.createElement("div");
            bubble.classList.add("bubble");
            bubble.style.left = Math.random() * 100 + "vw";
            bubble.style.animationDuration = Math.random() * 6 + 3 + "s";
            document.body.appendChild(bubble);
            
            setTimeout(() => {
                bubble.remove();
            }, 10000);
        }
    </script>
</body>
</html>

新建一个txt文件,然后把代码放进去

修改后缀为.html

就可以发给你的crush啦!

 

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值