HTML+CSS 动态菜单和登录框

摘要

实现了一个现代化的登录/注册界面,包含导航栏和弹窗表单。

HTML结构采用了响应式设计,包含Logo、导航链接和登录按钮。

CSS样式实现了背景图片、导航栏悬浮效果和表单美化,使用伪元素实现链接下划线动画。

JavaScript实现了弹窗切换功能。

界面整体简洁美观,使用了Ionic图标库增强视觉效果,适合作为网站的用户认证模块。

效果

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

在这里插入图片描述

代码

HTML

<!DOCTYPE html>
<html lang="en"><head><meta charset="UTF-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"></meta><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>Document</title><link rel="stylesheet" href="style.css"></link>
</head><body><header><h2 class="logo">Logo</h2><nav class="navigation"><a href="#">Home</a><a href="#">About</a><a href="#">Services</a><a href="#">Contact</a><button class="btnLogin-popup">Login</button></nav></header><div class="wrapper"><span class="icon-close"><ion-icon name="close"></ion-icon></span><div class="form-box login"><h2>Login</h2><div class="input-box"><span class="icon"><ion-icon name="mail"></ion-icon></span><input type="email" required><label>Email</label></div><div class="input-box"><span class="icon"><ion-icon name="lock-closed"></ion-icon></span><input type="password" required><label>Password</label></div><div class="remember-forget"><label for=""><input type="checkbox">Remember me</label><a href="#">Forgot Password</a></label></div><button type="submit" class="btn">Login</button><div class="login-register"><p>Don't have an account? <a href="#" class="register-link">Register</a></p></div></div><div class="form-box register"><h2>Registration</h2><div class="input-box"><span class="icon"><ion-icon name="person"></ion-icon></span><input type="text" required><label>Username</label></div><div class="input-box"><span class="icon"><ion-icon name="mail"></ion-icon></span><input type="email" required><label>Email</label></div><div class="input-box"><span class="icon"><ion-icon name="lock-closed"></ion-icon></span><input type="password" required><label>Password</label></div><div class="remember-forget"><label for=""><input type="checkbox">I agree to the terms & conditions</label></label></div><button type="submit" class="btn">Register</button><div class="login-register"><p>Already have an account? <a href="#" class="login-link">Login</a></p></div></div></div><script src="script.js"></script><!-- https://ionic.io/ionicons --><script type="module" src="https://unpkg.com/ionicons@7.1.0/dist/ionicons/ionicons.esm.js"></script><script nomodule src="https://unpkg.com/ionicons@7.1.0/dist/ionicons/ionicons.js"></script>
</body></html>

CSS

* {margin: 0;padding: 0;box-sizing: border-box;
}body {display: flex;justify-content: center;align-items: center;min-height: 100vh;background: url('bg.jpg') no-repeat;background-size: cover;background-position: center;
}header {position: fixed;top: 0;left: 0;width: 100%;padding: 20px 100px;/* background-color: red; */display: flex;justify-content: space-between;align-items: center;z-index: 99;
}.logo {font-size: 2em;color: #fff;-webkit-user-select: none;user-select: none;
}.navigation a {position: relative;font-size: 1.1em;color: #fff;text-decoration: none;font-weight: 500;margin-left: 40px;
}.navigation a::after {content: '';position: absolute;left: 0;bottom: -6px;width: 100%;height: 3px;background-color: #fff;border-radius: 5px;transform-origin: right;transform: scaleX(0);transition: transform 0.3s ease-in-out;
}.navigation a:hover::after {transform-origin: left;transform: scaleX(1);
}.navigation .btnLogin-popup {width: 130px;height: 50px;background-color: transparent;border: 2px solid #fff;outline: none;border-radius: 6px;cursor: pointer;font-size: 1.1em;color: #fff;font-weight: 500;margin: 0 40px;transition: 0.5s;
}.navigation .btnLogin-popup:hover {background-color: #fff;color: #162938;
}.wrapper {position: relative;width: 400px;height: 440px;background: transparent;border: 2px solid rgba(255, 255, 255, 0.5);border-radius: 20px;-webkit-backdrop-filter: blur(20px);backdrop-filter: blur(20px);box-shadow: 0 0 30px rgba(0, 0, 0, 0.5);display: flex;justify-content: center;align-items: center;overflow: hidden;transform: scale(0);transition: transform 0.5s ease, height 0.2s ease-in-out;
}.wrapper.active-popup{transform: scale(1);
}.wrapper.active{height: 520px;
}.wrapper .icon-close{position: absolute;top: 0;right: 0;width: 45px;height: 45px;background-color: #162938;font-size: 2em;color: #fff;display: flex;justify-content: center;align-items: center;border-bottom-left-radius: 20px;cursor: pointer;z-index: 1;
}.wrapper .form-box {width: 100%;padding: 40px;
}.wrapper .form-box.login{/* display: none; */transition: transform 0.18s ease-in-out;transform: translateX(0);
}
.wrapper.active .form-box.login{/* display: none; */transition: none;transform: translateX(-400px);
}.wrapper .form-box.register{/* display: none; */position: absolute;transition: none;transform: translateX(400px);
}.wrapper.active .form-box.register{/* display: none; */transition: transform 0.18s ease-in-out;transform: translateX(0);
}.wrapper .form-box h2 {font-size: 2em;color: #162938;text-align: center;
}.input-box {position: relative;width: 100%;height: 50px;border-bottom: 2px solid #162938;margin: 30px 0;
}.input-box label {position: absolute;top: 50%;left: 5px;transform: translateY(-50%);font-size: 1em;color: #162938;font-weight: 500;pointer-events: none;transition: .5s;
}.input-box input:focus~label,
.input-box input:valid~label {top: -5px;
}.input-box input {width: 100%;height: 100%;background: transparent;border: none;outline: none;font-size: 1em;color: #162938;font-weight: 600;padding: 0 35px 0 5px;
}.input-box .icon {position: absolute;right: 8px;font-size: 1.2em;color: #162938;line-height: 57px;
}.remember-forget {font-size: 0.9em;color: #162938;font-weight: 500;margin: -25px 0 15px;display: flex;justify-content: space-between;
}.remember-forget label input {accent-color: #162938;margin: 0 5px 0 0;
}.remember-forget a {color: #162938;text-decoration: none;
}.remember-forget a:hover {text-decoration: underline;
}.btn {width: 100%;height: 45px;background-color: #162938;border: none;outline: none;border-radius: 6px;cursor: pointer;font-size: 1em;color: #fff;font-weight: 500;
}.login-register{font-size: 0.9em;color: #162938;text-align: center;font-weight: 500;margin: 25px 0 10px ;
}
.login-register a{color: #162938;text-decoration: none;font-weight: 600;
}
.login-register a:hover{text-decoration: underline;
}

JavaScript

const wrapper = document.querySelector('.wrapper');
const loginLink = document.querySelector('.login-link');
const registerLink = document.querySelector('.register-link');
const btnPopup = document.querySelector('.btnLogin-popup');
const iconClose = document.querySelector('.icon-close');registerLink.addEventListener('click', () => {wrapper.classList.add('active');
});loginLink.addEventListener('click', () => {wrapper.classList.remove('active');
});
btnPopup.addEventListener('click', () => {wrapper.classList.add('active-popup');
});
iconClose.addEventListener('click', () => {wrapper.classList.remove('active-popup');
});

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.pswp.cn/bicheng/84821.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

抖音AI数字人对口型软件LatentSync最新版整合包,音频驱动口型讲话

本次和大家分享一个字节跳动开发的强大的音频驱动口型数字人视频制作软件LatentSync&#xff0c;我以前也分享过不少类似软件了&#xff0c;比如&#xff1a;EchoMimic、VideoReTalking、hallo。字节的推出的这个效果稍微更好一点&#xff0c;我制作了最新版的一键启动整合包。…

深入理解 PyTorch:从基础到高级应用

在深度学习的浪潮中&#xff0c;PyTorch 凭借其简洁易用、动态计算图等特性&#xff0c;迅速成为众多开发者和研究人员的首选框架。本文将深入探讨 PyTorch 的核心概念、基础操作以及高级应用&#xff0c;带你全面了解这一强大的深度学习工具。​ 一、PyTorch 简介​ PyTorch…

Java 中的 synchronized 与 Lock:深度对比、使用场景及高级用法

&#x1f4a1; 前言 在多线程并发编程中&#xff0c;线程安全问题始终是开发者需要重点关注的核心内容之一。Java 提供了多种机制来实现同步控制&#xff0c;其中最常用的两种方式是&#xff1a; 使用 synchronized 关键字使用 java.util.concurrent.locks.Lock 接口&#xf…

Notepad++如何列选

在 Notepad 中&#xff0c;你可以通过 列模式&#xff08;Column Mode&#xff09; 进行垂直选择文本&#xff08;列选&#xff09;&#xff0c;以下是具体操作方法&#xff1a; 方法 1&#xff1a;键盘 鼠标列选 按住 Alt 键&#xff08;或 Alt Shift&#xff09;。 按住鼠…

华为OD机考-水仙花数Ⅰ-逻辑分析(JAVA 2025B卷)

import java.util.*; public static Integer get(int count,int c){if(count<3||count>7){return -1;}//存储每位数的最高位……最低位int[] arr new int[count];List<Integer> res new ArrayList<>();for(int i(int) Math.pow(10,count-1);i<(int) Math…

基于 STL+VMD 二次分解的 Informer-LSTM 并行预测模型详解与案例

一、背景与动机 在时间序列预测中,如电力负荷、风速、交通流量等复杂数据常表现为: 非线性:趋势+季节+突变+噪声 多尺度:高频扰动与低频变化共存 长时依赖:远期信息也影响当前预测 传统模型(如 ARIMA、LSTM)往往无法兼顾全局趋势建模与局部扰动感知,因此我们提出一种 …

【Linux Learning】SSH连线出现警告:WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!

问题&#xff1a;WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY! Someone could be eavesdropping on you right now (man-in-the-middle attack)! It is al…

轻量级密码算法PRESENT的C语言实现(无第三方库)

一、PRESENT算法介绍 PRESENT是一种超轻量级分组密码算法&#xff0c;由Bogdanov等人在2007年提出&#xff0c;专门为资源受限环境如RFID标签和传感器网络设计。该算法在硬件实现上仅需1570个门等效电路(GE)&#xff0c;在保持较高安全性的同时实现了极小的硬件占用空间。PRES…

if的简化书写,提高执行效率

很多时候可能有下面判断 if(a0) {b1;} else if(a1) {b0;} 就是ba的反向值&#xff1a; a0;b1&#xff1b; a1;b0; 这时&#xff0c;可以简化如下&#xff1a; ba^1 使用异或&#xff0c;程序更简洁&#xff0c;执行效率也更高 其他的也可以类似使用按位异或优化代码

Vim 调用外部命令学习笔记

Vim 外部命令集成完全指南 文章目录 Vim 外部命令集成完全指南核心概念理解命令语法解析语法对比 常用外部命令详解文本排序与去重文本筛选与搜索高级 grep 搜索技巧文本替换与编辑字符处理高级文本处理编程语言处理其他实用命令 范围操作示例指定行范围处理复合命令示例 实用技…

bash挖矿木马事件全景复盘与企业级防御实战20250612

&#x1f427; CentOS “-bash 挖矿木马” 事件全景复盘与企业级防御实战 ✍️ 作者&#xff1a;Narutolxy | &#x1f4c5; 日期&#xff1a;2025-06-12 | &#x1f3f7;️ 标签&#xff1a;Linux 安全、应急响应、运维加固、实战复盘 &#x1f4d8; 内容简介 本文是一场真实…

「Linux中Shell命令」Shell命令基础

知识点详细解析 Shell简介 Shell是Linux操作系统系统中用户与操作系统内核交互的接口。它既是命令解释器,负责接收用户输入的命令并将其转换为内核能够理解的指令,也是一种脚本编程语言。作为Linux操作系统的重要组成部分,Shell扮演着用户与系统内核之间的"中间人"…

202557读书笔记|《梦里花落知多少(轻经典)》——有你在的地方才最美

《梦里花落知多少&#xff08;轻经典&#xff09;》作者三毛&#xff0c;物极必反&#xff0c;阴晴圆缺&#xff0c;小满即万全么&#xff1f;因为幸福过于满溢。所以幸福被收走了。 没有看过太多三毛的作品&#xff0c;给我的感觉她是很敏感&#xff0c;多愁善感及没有安全感…

对象映射 C# 中 Mapster 和 AutoMapper 的比较

Mapster和AutoMapper是C#领域两大主流对象映射库&#xff0c;各具特色。Mapster以高性能著称&#xff0c;使用表达式树实现零反射映射&#xff0c;首次编译后执行效率极高&#xff0c;适合对性能敏感的场景&#xff1b;AutoMapper则提供更丰富的功能集&#xff0c;如条件映射和…

QEMU源码全解析 —— 块设备虚拟化(26)

接前一篇文章:QEMU源码全解析 —— 块设备虚拟化(25) 本文内容参考: 《趣谈Linux操作系统》 —— 刘超,极客时间 《QEMU/KVM源码解析与应用》 —— 李强,机械工业出版社 Virt

微软PowerBI考试 PL300-选择 Power BI 模型框架【附练习数据】

微软PowerBI考试 PL300-选择 Power BI 模型框架 20 多年来&#xff0c;Microsoft 持续对企业商业智能 (BI) 进行大量投资。 Azure Analysis Services (AAS) 和 SQL Server Analysis Services (SSAS) 基于无数企业使用的成熟的 BI 数据建模技术。 同样的技术也是 Power BI 数据…

RED DA认证-EN18031网络安全常见问题以及解答

Q&#xff1a;RED DA是否对所有无线模块和设备强制要求&#xff1f; A&#xff1a;是的&#xff0c;RED DA适用于欧盟境内销售的所有无线设备&#xff0c;包括WWAN、蓝牙或Wi-Fi模块。唯一例外是GNSS模块&#xff08;仅支持接收功能&#xff0c;无需认证&#xff09;。 Q&…

腾讯开源 ovCompose 跨平台框架:实现一次跨三端(Android/iOS/鸿蒙)

在移动应用开发领域&#xff0c;跨平台技术一直是开发者们追求的目标&#xff0c;它能够帮助企业降低开发成本、提高开发效率&#xff0c;同时保证应用在不同平台上的一致性体验。2025 年 6 月 3 日&#xff0c;腾讯视频团队迎来了一个重要的里程碑 —— 正式发布 ovCompose 跨…

对3D对象进行形变分析

1&#xff0c;目的 分析3D实例对象相对标准参照物的形变。 一般用于质地较软的材质&#xff08;例如橡胶&#xff0c;布料&#xff09;查找&#xff0c;检查等。 标准参考模型 需匹配的实例&#xff1a; 形变后的模型&#xff1a;* 形变后的模型&#xff1a; 实例形变后的…

宝塔面板WordPress中使用Contact Form 7插件收不到邮件的解决方法

如果是宝塔面板的环境下&#xff0c;在WordPress中使用Contact Form 7插件提交表单时显示成功&#xff0c;但邮箱未收到邮件&#xff0c;可能是由于服务器邮件功能配置问题。以下是几种常见解决方法&#xff1a; 1. 检查邮件发送方式 默认情况下&#xff0c;Contact Form 7 使…