介绍
-
深色背景搭配霓虹蓝色
-
动态粒子动画背景
-
输入框聚焦动画效果
-
科技感字体和图标
-
悬浮按钮效果
HTML
- <!DOCTYPE html>
- <html lang="zh-CN">
- <head>
- <meta charset="UTF-8">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <title>高科技登录</title>
- <style>
- * {
- margin: 0;
- padding: 0;
- box-sizing: border-box;
- font-family: 'Segoe UI', 'Roboto', sans-serif;
- }
- body {
- display: flex;
- justify-content: center;
- align-items: center;
- min-height: 100vh;
- background: #0a0e21;
- overflow: hidden;
- }
- #particles-js {
- position: absolute;
- width: 100%;
- height: 100%;
- z-index: 1;
- }
- .container {
- position: relative;
- z-index: 2;
- width: 380px;
- padding: 40px;
- background: rgba(13, 18, 39, 0.8);
- backdrop-filter: blur(10px);
- border-radius: 10px;
- box-shadow: 0 15px 35px rgba(0, 0, 0, 0.5);
- border: 1px solid rgba(255, 255, 255, 0.1);
- }
- .container::before {
- content: '';
- position: absolute;
- top: -2px;
- left: -2px;
- right: -2px;
- bottom: -2px;
- z-index: -1;
- background: linear-gradient(45deg, #ff005e, #ffeb3b, #00bcd4, #4caf50);
- background-size: 400%;
- border-radius: 10px;
- animation: glow 20s linear infinite;
- filter: blur(10px);
- opacity: 0.5;
- }
- @keyframes glow {
- 0% { background-position: 0 0; }
- 50% { background-position: 400% 0; }
- 100% { background-position: 0 0; }
- }
- .login-box {
- display: flex;
- flex-direction: column;
- align-items: center;
- }
- h2 {
- color: #00e0ff;
- font-size: 2em;
- letter-spacing: 2px;
- margin-bottom: 40px;
- text-transform: uppercase;
- text-shadow: 0 0 10px #00e0ff;
- }
- .input-box {
- position: relative;
- width: 100%;
- margin-bottom: 30px;
- }
- .input-box input {
- width: 100%;
- padding: 15px 20px;
- background: transparent;
- border: none;
- outline: none;
- border-radius: 5px;
- color: #fff;
- font-size: 1em;
- border: 1px solid rgba(255, 255, 255, 0.1);
- transition: all 0.3s;
- }
- .input-box input:focus {
- border-color: #00e0ff;
- box-shadow: 0 0 15px rgba(0, 224, 255, 0.5);
- }
- .input-box label {
- position: absolute;
- top: 15px;
- left: 20px;
- pointer-events: none;
- color: rgba(255, 255, 255, 0.5);
- transition: 0.3s;
- }
- .input-box input:focus ~ label,
- .input-box input:valid ~ label {
- top: -12px;
- left: 10px;
- font-size: 0.8em;
- background: #0a0e21;
- padding: 0 10px;
- color: #00e0ff;
- }
- .icon {
- position: absolute;
- top: 15px;
- right: 20px;
- color: rgba(255, 255, 255, 0.5);
- transition: 0.3s;
- }
- .input-box input:focus ~ .icon {
- color: #00e0ff;
- }
- .options {
- width: 100%;
- display: flex;
- justify-content: space-between;
- margin-bottom: 30px;
- font-size: 0.9em;
- }
- .remember {
- display: flex;
- align-items: center;
- color: rgba(255, 255, 255, 0.7);
- }
- .remember input {
- margin-right: 5px;
- accent-color: #00e0ff;
- }
- .forgot {
- color: #00e0ff;
- text-decoration: none;
- transition: 0.3s;
- }
- .forgot:hover {
- text-shadow: 0 0 5px #00e0ff;
- }
- button {
- width: 100%;
- padding: 15px;
- background: linear-gradient(45deg, #00bcd4, #0072ff);
- border: none;
- border-radius: 5px;
- color: #fff;
- font-size: 1.1em;
- letter-spacing: 1px;
- cursor: pointer;
- transition: 0.3s;
- box-shadow: 0 5px 15px rgba(0, 114, 255, 0.3);
- }
- button:hover {
- background: linear-gradient(45deg, #0072ff, #00bcd4);
- box-shadow: 0 5px 20px rgba(0, 114, 255, 0.5);
- transform: translateY(-2px);
- }
- .signup {
- margin-top: 25px;
- color: rgba(255, 255, 255, 0.7);
- font-size: 0.9em;
- text-align: center;
- }
- .signup a {
- color: #00e0ff;
- text-decoration: none;
- transition: 0.3s;
- }
- .signup a:hover {
- text-shadow: 0 0 5px #00e0ff;
- }
- .scan-effect {
- position: absolute;
- top: 0;
- left: 0;
- width: 100%;
- height: 3px;
- background: linear-gradient(90deg, transparent, #00e0ff, transparent);
- animation: scan 2s linear infinite;
- opacity: 0.7;
- }
- @keyframes scan {
- 0% { top: 0; }
- 100% { top: 100%; }
- }
- </style>
- </head>
- <body>
- <div id="particles-js"></div>
- <div class="container">
- <div class="scan-effect"></div>
- <div class="login-box">
- <h2>安全登录</h2>
- <div class="input-box">
- <input type="text" required>
- <label>用户名 / 邮箱</label>
- </div>
- <div class="input-box">
- <input type="password" required>
- <label>密码</label>
- </div>
- <div class="options">
- <label class="remember">
- <input type="checkbox"> 记住我
- </label>
- <a href="#" class="forgot">忘记密码?</a>
- </div>
- <button>登录系统</button>
- <div class="signup">
- 没有账户? <a href="#">注册新账户</a>
- </div>
- </div>
- </div>
- <script src="https://cdn.jsdelivr.net/particles.js/2.0.0/particles.min.js"></script>
- <script>
- // 粒子背景初始化
- particlesJS('particles-js', {
- particles: {
- number: { value: 80, density: { enable: true, value_area: 800 } },
- color: { value: "#00e0ff" },
- shape: { type: "circle" },
- opacity: { value: 0.5, random: true },
- size: { value: 3, random: true },
- line_linked: {
- enable: true,
- distance: 150,
- color: "#00e0ff",
- opacity: 0.4,
- width: 1
- },
- move: {
- enable: true,
- speed: 2,
- direction: "none",
- random: true,
- straight: false,
- out_mode: "out",
- bounce: false
- }
- },
- interactivity: {
- detect_on: "canvas",
- events: {
- onhover: { enable: true, mode: "grab" },
- onclick: { enable: true, mode: "push" },
- resize: true
- }
- },
- retina_detect: true
- });
- // 输入框效果
- const inputs = document.querySelectorAll('input');
- inputs.forEach(input => {
- input.addEventListener('focus', () => {
- input.parentElement.classList.add('focused');
- });
- input.addEventListener('blur', () => {
- if (input.value === '') {
- input.parentElement.classList.remove('focused');
- }
- });
- });
- </script>
- </body>
- </html>