当前位置: 首页 > article >正文

介绍几种创意登录页(含完整源码)

今天为大家收集了几种不同风格的登录页,搭配动态渐变背景,效果绝对惊艳!

CSS3实现动态渐变+玻璃拟态登录页

 

一、开篇语

纯CSS实现当下最火的玻璃拟态(Morphism)风格登录页,搭配动态渐变背景,效果绝对惊艳!

二、设计特色
  • ✅ 流动渐变背景

  • ✅ 毛玻璃视觉效果

  • ✅ 动态标签动画

  • ✅ 按钮流光特效

三、关键技术
  1. CSS渐变背景background: linear-gradient()

  2. 背景模糊backdrop-filter: blur()

  3. 形状动画@keyframes控制渐变运动

  4. 边框技巧:利用mask实现内边框

四、完整代码
<!-- 方案二:动态渐变 + 玻璃拟态 -->
<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <title>登录 - 玻璃拟态版</title>
    <style>
        :root {
            --primary: #7f5af0;
            --secondary: #2cb67d;
        }

        * { margin: 0; padding: 0; box-sizing: border-box; }

        body {
            height: 100vh;
            background: linear-gradient(45deg, #16161a, #242629);
            display: flex;
            justify-content: center;
            align-items: center;
            position: relative;
            overflow: hidden;
        }

        .bg-blob {
            position: absolute;
            width: 500px;
            height: 500px;
            background: linear-gradient(45deg, var(--primary), var(--secondary));
            border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%;
            animation: gradientMove 15s infinite;
            filter: blur(60px);
            opacity: 0.3;
        }

        @keyframes gradientMove {
            0% { transform: rotate(0deg) scale(1); }
            50% { transform: rotate(180deg) scale(1.2); }
            100% { transform: rotate(360deg) scale(1); }
        }

        .login-container {
            position: relative;
            width: 400px;
            background: rgba(255,255,255,0.05);
            padding: 40px;
            border-radius: 20px;
            backdrop-filter: blur(10px);
            border: 1px solid rgba(255,255,255,0.1);
            box-shadow: 0 25px 45px rgba(0,0,0,0.2);
        }

        .input-box {
            position: relative;
            margin: 30px 0;
        }

        input {
            width: 100%;
            padding: 15px 20px;
            background: rgba(255,255,255,0.1);
            border: 2px solid transparent;
            border-radius: 10px;
            color: white;
            font-size: 16px;
            transition: all 0.3s;
        }

        input:focus {
            outline: none;
            border-color: var(--primary);
            background: rgba(255,255,255,0.2);
        }

        .floating-label {
            position: absolute;
            left: 20px;
            top: 50%;
            transform: translateY(-50%);
            color: rgba(255,255,255,0.6);
            pointer-events: none;
            transition: all 0.3s;
        }

        input:focus ~ .floating-label,
        input:valid ~ .floating-label {
            top: -10px;
            left: 10px;
            font-size: 12px;
            color: var(--primary);
        }

        .login-btn {
            width: 100%;
            padding: 15px;
            background: linear-gradient(45deg, var(--primary), var(--secondary));
            border: none;
            border-radius: 10px;
            color: white;
            font-size: 16px;
            cursor: pointer;
            transition: all 0.3s;
            position: relative;
            overflow: hidden;
        }

        .login-btn::before {
            content: '';
            position: absolute;
            top: 0;
            left: -100%;
            width: 100%;
            height: 100%;
            background: linear-gradient(
                90deg,
                transparent,
                rgba(255,255,255,0.2),
                transparent
            );
            transition: 0.5s;
        }

        .login-btn:hover::before {
            left: 100%;
        }
    </style>
</head>
<body>
    <div class="bg-blob"></div>
    <div class="bg-blob" style="right: -200px; bottom: -200px;"></div>
    
    <div class="login-container">
        <h2 style="color: white; text-align: center; margin-bottom: 30px;">系统登录</h2>
        <div class="input-box">
            <input type="text" required>
            <span class="floating-label">用户名</span>
        </div>
        <div class="input-box">
            <input type="password" required>
            <span class="floating-label">密码</span>
        </div>
        <button class="login-btn">立即登录</button>
    </div>
</body>
</html>
五、实现要点
  1. 使用伪元素创建流动背景

  2. 巧用CSS滤镜实现磨砂效果

  3. 输入框焦点状态控制

  4. 按钮悬停动画实现

六、浏览器兼容性

⚠️ 注意:backdrop-filter在Firefox中需要开启实验特性

粒子特效+浮动动画

一、技术亮点
  1. 粒子动画系统:使用particles.js实现可交互的粒子背景

  2. 玻璃拟态设计:半透明背景+模糊效果

  3. 动态输入框:标签浮动动画

  4. 悬停交互:卡片悬浮效果

二、完整代码实现
<!-- 方案一:粒子背景 + 浮动动画 -->
<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <title>登录 - 粒子特效版</title>
    <style>
        * { margin: 0; padding: 0; box-sizing: border-box; }
        
        body {
            height: 100vh;
            background: #0a0a2e;
            display: flex;
            justify-content: center;
            align-items: center;
            overflow: hidden;
        }

        #particles-js {
            position: absolute;
            width: 100%;
            height: 100%;
        }

        .login-box {
            position: relative;
            width: 400px;
            background: rgba(255, 255, 255, 0.1);
            padding: 40px;
            border-radius: 20px;
            backdrop-filter: blur(10px);
            box-shadow: 0 15px 35px rgba(0,0,0,0.2);
            transform: translateY(0);
            transition: all 0.3s;
        }

        .login-box:hover {
            transform: translateY(-5px);
        }

        .input-group {
            margin: 30px 0;
            position: relative;
        }

        input {
            width: 100%;
            padding: 15px;
            background: rgba(255,255,255,0.1);
            border: none;
            border-radius: 8px;
            color: white;
            font-size: 16px;
            transition: all 0.3s;
        }

        input:focus {
            outline: none;
            background: rgba(255,255,255,0.2);
        }

        label {
            position: absolute;
            left: 15px;
            top: 50%;
            transform: translateY(-50%);
            color: rgba(255,255,255,0.6);
            pointer-events: none;
            transition: all 0.3s;
        }

        input:focus ~ label,
        input:valid ~ label {
            top: -10px;
            left: 5px;
            font-size: 12px;
            color: #7f5af0;
        }

        button {
            width: 100%;
            padding: 15px;
            background: linear-gradient(45deg, #7f5af0, #2cb67d);
            border: none;
            border-radius: 8px;
            color: white;
            font-size: 16px;
            cursor: pointer;
            transition: all 0.3s;
        }

        button:hover {
            transform: scale(1.05);
            box-shadow: 0 5px 15px rgba(127,90,240,0.4);
        }
    </style>
</head>
<body>
    <div id="particles-js"></div>
    
    <div class="login-box">
        <h2 style="color: white; text-align: center; margin-bottom: 30px;">欢迎登录</h2>
        <div class="input-group">
            <input type="text" required>
            <label>用户名</label>
        </div>
        <div class="input-group">
            <input type="password" required>
            <label>密码</label>
        </div>
        <button>立即登录</button>
    </div>

    <script src="https://cdn.jsdelivr.net/particles.js/2.0.0/particles.min.js"></script>
    <script>
        particlesJS('particles-js', {
            particles: {
                number: { value: 80 },
                color: { value: '#7f5af0' },
                shape: { type: 'circle' },
                opacity: { value: 0.5 },
                size: { value: 3 },
                move: {
                    enable: true,
                    speed: 2,
                    direction: 'none',
                    random: false,
                    straight: false,
                    out_mode: 'out',
                    bounce: false,
                }
            },
            interactivity: {
                detect_on: 'canvas',
                events: {
                    onhover: { enable: true, mode: 'repulse' },
                    onclick: { enable: true, mode: 'push' },
                    resize: true
                }
            }
        });
    </script>
</body>
</html>
三、实现步骤
  1. 引入particles.js库

  2. 创建canvas容器

  3. 设计玻璃拟态登录框

  4. 添加输入框浮动标签动画

  5. 实现悬停交互效果

更多案例请参考开源项目:https://gitee.com/zunyi-gabe/Creative-Web-Collection.git 

欢迎 Star 和 Fork 项目,一起构建更完善的权限管理体系!

 

 

 

 


http://www.kler.cn/a/613623.html

相关文章:

  • Uniapp使用大疆SDK打包离线原生插件二
  • 力扣HOT100之普通数组:41. 缺失的第一个正数
  • uvm configuration
  • Starrocks架构及如何选择
  • 【Golang】第八弹----面向对象编程
  • Qt下载模板到本地文件内容丢失问题
  • 2025年最新自动化/控制保研夏令营预推免面试真题分享(东南大学苏州校区/华东理工/南航/天大)
  • Redis 中的过期策略和内存淘汰策略
  • 项目-苍穹外卖(十六) Apache ECharts+数据统计
  • Vue学习笔记集--pnpm包管理器
  • 企业高效访问海外SAAS应用,SD-WAN出口网络专线提高办公效率
  • 蓝桥杯备考:DFS之数独
  • Unity高渲染管线
  • linux0.11内核源码修仙传第十一章——硬盘初始化
  • 数据库约束、常见语句等
  • VGG 改进:添加ScConv空间与通道特征重构卷积
  • pip show protobuf ValueError: invalid literal for int() with base 10: ‘‘
  • 【redis】前缀树 trie-radix tree-rax
  • 协作机械臂需要加安全墙吗? 安全墙 光栅 干涉区
  • 详细比较StringRedisTemplate和RedisTemplate的区别及使用方法,及解决融合使用方法