动态星空科技感粒子登录页 附代码复制即可用

效果图(仔细看会有星空效果和粒子效果);背景可以放到任意页面中
在这里插入图片描述
代码:

<html lang="en"><head>
    <meta charset="UTF-8">
    <title>登录</title>
    <style>
        *{
            margin: 0;
            padding: 0;
        }
        .cavs{
            z-index:1;
            position: fixed;
            width:95%;
            margin-left: 20px;
            margin-right: 20px;
        }

        html,body{
            width: 100%;
            height: 100%;

            background-image: url("loginbj.png");
            /*background-image: -webkit-linear-gradient(top, #02164f, #000);*/
            /*background-image: -moz-linear-gradient(top, #02164f, #000);*/
            /*background-image: -ms-linear-gradient(top, #02164f, #000);*/
            /*background-image: -o-linear-gradient(top, #02164f, #000);*/
            /*background-image: linear-gradient(to bottom, #02164f, #000);*/
            /*background-color: #1A1A1A;*/
        }



        .dela-presets-container-1 .dela-preset-1-2 {
            position: relative;
            font-size: 16px;
            width: 24.4em;
            min-width: 11em;
            padding: 5.6em 3.68em 6.1em 3.68em;
            box-shadow: 0 0 1em rgba(0, 0, 0, 0.2);
            font-family: Roboto;
            background: linear-gradient(to top, #b76cd2 0, #4c3bb3 100%);
        }
        .dela-presets-container-1 .dela-preset-1-2 .dela-form__title {
            color: #fff;
            margin: 0;
            font-size: 2.38em;
            font-weight: 400;
            text-align: center;
            margin-bottom: 0.89em;
        }
        .dela-presets-container-1 .dela-preset-1-2 {
            position: relative;
            font-size: 16px;
            width: 390px;
            padding: 56px 65px 55px 65px;
            box-shadow: 0 0 1em rgba(0, 0, 0, 0.2);
            font-family: Roboto;
            background: linear-gradient(to top, #b76cd2 0, #4c3bb3 100%);
        }

        .dela-presets-container-1 .dela-preset-1-2 input[type="email"], .dela-presets-container-1 .dela-preset-1-2 input[type="password"], .dela-presets-container-1 .dela-preset-1-2 input[type="text"] {
            color: #fff;
            font-family: Roboto;
            font-size: 1em;
            font-weight: 200;
            width: 100%;
            background: none;
            border: none;
            padding: 0.8em 0;
            border-bottom: 0.063em solid rgba(255, 255, 255, 0.2);
            margin-bottom: 1.1em;
            border-radius: 0;
        }

        .dela-presets-container-1{
            z-index: 100;
            position: absolute;
            left: 35%;
            opacity: 0.8;
            top: 100px;
        }
        .dela-presets-container-1 .dela-preset-1-2 .dela-form__checkbox {
            display: inline-block;
            font-size: 0.875em;
            margin-top: 0.7em;
            font-weight: 200;
            cursor: pointer;
            color: #fff;
            overflow: hidden;
            position: relative;
        }

        .dela-presets-container-1 .dela-preset-1-2 input[type="submit"] {
            margin: 0 auto;
            display: block;
            color: #fff;
            font-family: Roboto;
            font-size: 1em;
            font-weight: 200;
            width: 10.25em;
            min-height: 2.71em;
            background: none;
            border: 0.063em solid #fff;
            border-radius: 0.6em;
            cursor: pointer;
            margin-top: 2.1em;
            -webkit-appearance: none;
        }




        .stars, .twinkl {
            position:absolute;
            top:0;
            left:0;
            right:0;
            bottom:0;
            width:100%;
            height:100%;
            display:block;
        }
        .ball{
            width: 100%;
            height: 282px;
            position:absolute;
            left:0;
            right:0;
            bottom:0;
            display:block;
            background:#000 url(ball.jpg) repeat top center;
            z-index:0;
        }
        .stars {
            background:#000 url(stars.png) repeat top center;
            z-index:0;
        }

        .twinkl{
            background:transparent url(twinkling.png) repeat top center;
            z-index:0;

            -moz-animation:move-twink-back 200s linear infinite;
            -ms-animation:move-twink-back 200s linear infinite;
            -o-animation:move-twink-back 200s linear infinite;
            -webkit-animation:move-twink-back 200s linear infinite;
            animation:move-twink-back 200s linear infinite;
        }

        @keyframes move-twink-back {
            from {background-position:0 0;}
            to {background-position:-10000px 5000px;}
        }
         input::-webkit-input-placeholder {
             /* WebKit, Blink, Edge 适配谷歌*/
             color: #fff !important;
         }

        input::-moz-placeholder {
            /* Mozilla Firefox 4 to 18 适配火狐*/
            color: #fff !important;
        }

        input:-moz-placeholder {
            /* Mozilla Firefox 19+ 适配火狐*/
            color: #fff !important;
        }

        input:-ms-input-placeholder {
            /* Internet Explorer 10-11 适配ie*/
            color: #fff !important;
        }

        input:focus {
            outline-offset: -2px;
        }
        :focus {
            outline: -webkit-focus-ring-color auto 0px;
        }
    </style>
</head>
<body style="">
<canvas class="cavs" width="1857" height="927"></canvas>

<div class="stars"></div>
<div class="twinkl"></div>
<div class="ball"></div>
<div class="dela-presets-container-1">
<form class="dela-preset-1-2" action="?" method="get">
    <p class="dela-form__title">登录</p>
    <input type="text" name="name" placeholder="Name" required="" autocomplete="name">
    <input type="password" name="password" id="pass-1" placeholder="Password" required="">
    <input type="password" placeholder="Code" style="width: 216px;vertical-align: top;display: inline-block" name="repeat" oninput="this.setCustomValidity(this.value != document.getElementById('pass-'+1).value ? 'Passwords are not the same.' : '')"
        required="">
    <a style="display: inline-block;width: 164px;height: 43px;border: 1px #f00 solid"></a>
    <label class="dela-form__checkbox">记住我
        <input type="checkbox" name="policy" value="1" required="">
        <span></span></label>
    <input type="submit" name="submit" value="Login"></form>

</div>
<script src="jquery-3.0.0.min.js"></script>
<script src="ban.js"></script></body></html>

资源链接:https://download.csdn.net/download/qq_42197013/12937115

以下是一个简单的HTML星空粒子特效代码: ```html <!DOCTYPE html> <html> <head> <style> body { margin: 0; overflow: hidden; } canvas { display: block; } </style> </head> <body> <canvas id="starfield"></canvas> <script> // 创建画布 var canvas = document.getElementById("starfield"); var ctx = canvas.getContext("2d"); // 设置画布大小 canvas.width = window.innerWidth; canvas.height = window.innerHeight; // 创建星星数组 var stars = []; var numStars = 100; // 初始化星星 for (var i = 0; i < numStars; i++) { stars[i] = { x: Math.random() * canvas.width, y: Math.random() * canvas.height, radius: Math.random() * 1.5 + 1, vx: Math.floor(Math.random() * 3) - 1.5, vy: Math.floor(Math.random() * 3) - 1.5 }; } // 绘制星星 function drawStars() { ctx.clearRect(0, 0, canvas.width, canvas.height); ctx.fillStyle = "white"; for (var i = 0; i < numStars; i++) { var star = stars[i]; ctx.beginPath(); ctx.arc(star.x, star.y, star.radius, 0, Math.PI * 2, false); ctx.fill(); } } // 更新星星位置 function updateStars() { for (var i = 0; i < numStars; i++) { var star = stars[i]; // 更新位置 star.x += star.vx; star.y += star.vy; // 边界检测 if (star.x < 0 || star.x > canvas.width) { star.vx = -star.vx; } if (star.y < 0 || star.y > canvas.height) { star.vy = -star.vy; } } } // 动画循环 function animate() { drawStars(); updateStars(); requestAnimationFrame(animate); } // 开始动画 animate(); </script> </body> </html> ``` 这段代码使用HTML5的canvas元素绘制了一个星空粒子特效。它创建了一个画布,然后在画布上绘制了一定数量的随机大小和位置的白色圆形来表示星星。每个星星都有一个随机的速度,它们会在画布上移动,并在达到边界时反弹。通过不断更新星星的位置并重新绘制它们,实现了一个看起来像星空动态效果。你可以将该代码复制粘贴到一个HTML文件中,然后在浏览器中打开该文件来查看效果。
评论 6
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值