【前端】六款高颜值登录页面

news/2024/11/5 12:21:40/文章来源:https://www.cnblogs.com/o-O-oO/p/18527579

原创 吴旭东 无限大infinity

第一款–简约风格

HTML:

<!DOCTYPE html>  
<html lang="zh">  
<head>  <meta charset="UTF-8">  <meta name="viewport" content="width=device-width, initial-scale=1.0">  <link rel="stylesheet" href="styles.css">  <title>登录界面</title>  
</head>  
<body>  <div class="login-container">  <h1>欢迎回来</h1>  <form id="loginForm" onsubmit="return handleSubmit()">  <div class="input-group">  <label for="username">用户名</label>  <input type="text" id="username" placeholder="输入用户名" required>  </div>  <div class="input-group">  <label for="password">密码</label>  <input type="password" id="password" placeholder="输入密码" required>  </div>  <button type="submit">登录</button>  </form>  <div id="message"></div>  <div class="footer">  <a href="#">忘记密码?</a>  </div>  </div>  <script src="script.js"></script>  
</body>  
</html>

CSS (styles.css)

body {  display: flex;  justify-content: center;  align-items: center;  height: 100vh;  background: linear-gradient(135deg, #a8dadc, #ffafcc);  font-family: 'Arial', sans-serif;  
}  .login-container {  background: white;  padding: 30px;  border-radius: 10px;  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);  max-width: 400px;  width: 100%;  
}  h1 {  text-align: center;  color: #333;  
}  .input-group {  margin-bottom: 20px;  
}  label {  display: block;  margin-bottom: 5px;  font-weight: bold;  color: #555;  
}  input {  width: 100%;  padding: 12px;  border: 1px solid #ccc;  border-radius: 5px;  transition: border-color 0.3s;box-sizing: border-box; /* 确保padding不超出宽度 */
}  input:focus {  border-color: #007bff;  outline: none;  
}  button {  width: 100%;  padding: 12px;  background-color: #96dee0;  color: white;  border: none;  border-radius: 5px;  font-weight: bold;  cursor: pointer;  transition: background-color 0.3s;  
}  button:hover {  background-color: #0056b3;  
}  #message {  text-align: center;  margin-top: 15px;  color: red;  
}  .footer {  text-align: center;  margin-top: 20px;  
}  .footer a {  color: #6e747a;  text-decoration: none;  
}  .footer a:hover {  text-decoration: underline;  
}

JavaScript (script.js)

function handleSubmit() {const username = document.getElementById('username').value;const password = document.getElementById('password').value;const messageElement = document.getElementById('message');// 这里可以简单验证用户名和密码if (username === 'user' && password === 'pass') {messageElement.textContent = '登录成功!';messageElement.style.color = 'green';} else {messageElement.textContent = '用户名或密码错误!';messageElement.style.color = 'red';}// 阻止表单的默认提交行为return false;
}

第二款–雪花飘落

以下是一个简单的登录页面示例,使用HTML、CSS和JavaScript创建,背景为雪花飘落的效果。我们将使用CSS动画和JavaScript来实现雪花效果。
HTML:

<!DOCTYPE html>  
<html lang="zh">  
<head>  <meta charset="UTF-8">  <meta name="viewport" content="width=device-width, initial-scale=1.0">  <link rel="stylesheet" href="styles.css">  <title>登录页面</title>  
</head>  
<body>  <div class="snowflakes" aria-hidden="true">  <div class="snowflake">❄</div>  <div class="snowflake">❄</div>  <div class="snowflake">❄</div>  <div class="snowflake">❄</div>  <div class="snowflake">❄</div>  <div class="snowflake">❄</div>  <div class="snowflake">❄</div>  <div class="snowflake">❄</div>  <div class="snowflake">❄</div>  <div class="snowflake">❄</div>  </div>  <div class="login-container">  <h1>欢迎回来</h1>  <form id="login-form">  <input type="text" placeholder="用户名" required>  <input type="password" placeholder="密码" required>  <button type="submit">登录</button>  </form>  <div id="message" class="message"></div>  </div>  <script src="script.js"></script>  
</body>  
</html>

CSS (styles.css):

body {  margin: 0;  font-family: 'Arial', sans-serif;  background-color: #282c34;  overflow: hidden;  
}  .snowflakes {  position: absolute;  top: 0;  left: 0;  width: 100%;  height: 100%;  pointer-events: none;  overflow: hidden;  z-index: 1;  
}  .snowflake {  position: absolute;  top: -10%;  color: white;  font-size: 1em;  opacity: 0.8;  animation: fall linear infinite;  
}  @keyframes fall {  0% {  transform: translateX(0);  top: -10%;  }  100% {  transform: translateX(20px);  top: 100%;  }  
}  /* 使雪花飘落更具随机性 */  
.snowflake:nth-of-type(1) { left: 10%; animation-duration: 3s; }  
.snowflake:nth-of-type(2) { left: 20%; animation-duration: 5s; }  
.snowflake:nth-of-type(3) { left: 30%; animation-duration: 6s; }  
.snowflake:nth-of-type(4) { left: 40%; animation-duration: 4s; }  
.snowflake:nth-of-type(5) { left: 50%; animation-duration: 7s; }  
.snowflake:nth-of-type(6) { left: 60%; animation-duration: 5s; }  
.snowflake:nth-of-type(7) { left: 70%; animation-duration: 3.5s; }  
.snowflake:nth-of-type(8) { left: 80%; animation-duration: 6.5s; }  
.snowflake:nth-of-type(9) { left: 90%; animation-duration: 7s; }  
.snowflake:nth-of-type(10) { left: 15%; animation-duration: 4.5s; }  .login-container {  position: relative;  z-index: 2;  max-width: 400px;  margin: 100px auto;  padding: 20px;  background: rgba(255, 255, 255, 0.9);  border-radius: 10px;  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);  
}  h1 {  text-align: center;  color: #333;  
}  input {  width: 100%;  padding: 10px;  margin: 10px 0;  border: 1px solid #ccc;  border-radius: 5px;  box-sizing: border-box; /* 确保padding不超出宽度 */  
}  button {  padding: 10px;  width: 100%;  background-color: #007bff;  color: white;  border: none;  border-radius: 5px;  cursor: pointer;  transition: background-color 0.3s;  
}  button:hover {  background-color: #0056b3;  
}  .message {  text-align: center;  margin-top: 10px;  color: red;  
}

JavaScript (script.js):

document.getElementById('login-form').addEventListener('submit', function(event) {event.preventDefault(); // 防止表单提交及页面刷新// 模拟登录验证const message = document.getElementById('message');message.textContent = '登录成功!欢迎!';message.style.color = 'green';// 在这里可以添加进一步的验证和操作
});

第三款–中国风


HTML:

<!DOCTYPE html>  
<html lang="zh">  
<head>  <meta charset="UTF-8">  <meta name="viewport" content="width=device-width, initial-scale=1.0">  <link rel="stylesheet" href="styles.css">  <title>中国风登录页面</title>  
</head>  
<body>  <div class="container">  <div class="login-container">  <h1>欢迎回来</h1>  <form id="login-form">  <input type="text" placeholder="用户名" required>  <input type="password" placeholder="密码" required>  <button type="submit">登录</button>  </form>  <div id="message" class="message"></div>  </div>  </div>  <script src="script.js"></script>  
</body>  
</html>

CSS (styles.css):

body {  margin: 0;  font-family: 'Microsoft YaHei', 'Arial', sans-serif;  background-image: url('img/1.png'); background-size: cover;  background-position: center;  color: #2c2c2c;  
}  .container {  display: flex;  justify-content: center;  align-items: center;  height: 100vh;  border-radius: 10px;  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);  
}  .login-container {  width: 340px;  padding: 20px;  background-color: #f9f9f9;  border-radius: 10px;  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);  border: 2px solid #bf4a4a; text-align: center;  
}  h1 {  font-size: 24px;  margin-bottom: 20px;  color: #bf4a4a; 
}  input {  width: 100%;  padding: 10px;  margin: 10px 0;  border: 2px solid #bf4a4a;  border-radius: 5px;  font-size: 16px;  box-sizing: border-box;  
}  button {  padding: 10px;  width: 100%;  background-color: #bf4a4a;  color: white;  border: none;  border-radius: 5px;  cursor: pointer;  font-size: 16px;  transition: background-color 0.3s;  
}  button:hover {  background-color: #a63939;  
}  .message {  text-align: center;  margin-top: 10px;  color: red;  
}  .login-container::before {  content: "🍃"; font-size: 50px;   position: absolute;  top: -30px;  left: 20px;  
}  .login-container::after {  content: "🍃";  font-size: 50px;  position: absolute;  bottom: -30px;  right: 20px;  
}

JavaScript (script.js):

document.getElementById('login-form').addEventListener('submit', function(event) {event.preventDefault(); // 防止表单提交及页面刷新// 模拟登录验证const message = document.getElementById('message');message.textContent = '登录成功!欢迎!';message.style.color = 'green';// 在这里可以添加进一步的验证和操作
});

第四款–水墨丹青


HTML:

<!DOCTYPE html>  
<html lang="zh">  
<head>  <meta charset="UTF-8">  <meta name="viewport" content="width=device-width, initial-scale=1.0">  <link rel="stylesheet" href="styles.css">  <title>水墨丹青登录页面</title>  
</head>  
<body>  <div class="background">  <div class="login-container">  <h1>欢迎回来</h1>  <form id="login-form">  <input type="text" placeholder="用户名" required>  <input type="password" placeholder="密码" required>  <button type="submit">登录</button>  </form>  <div id="message" class="message"></div>  </div>  </div>  <script src="script.js"></script>  
</body>  
</html>

CSS (styles.css):

body {  margin: 0;  font-family: 'Microsoft YaHei', 'Arial', sans-serif;  color: #333;  
}  .background {  height: 100vh;  background-image: url('img/1.png');background-size: cover;  background-position: center;  position: relative;  display: flex;  justify-content: center;  align-items: center;  
}  .login-container {  width: 400px;  padding: 30px;  background: rgba(255, 255, 255, 0.9);   border-radius: 10px;  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);  text-align: center;  position: relative;  border: 2px solid #5a2929;  
}  h1 {  font-size: 28px;  margin-bottom: 20px;  color: #5a2929; /* 深色标题 */  
}  input {  width: 100%;  padding: 12px;  margin: 15px 0;  border: 2px solid #5a2929; border-radius: 5px;  font-size: 16px;  background-color: #f1f1f1;  box-sizing: border-box; 
}  button {  padding: 12px;  width: 100%;  background-color: #5a2929;   color: white;  border: none;  border-radius: 5px;  cursor: pointer;  font-size: 18px;  transition: background-color 0.3s;  
}  button:hover {  background-color: #3e1e1e; 
}  .message {  margin-top: 15px;  color: red;  
}  .login-container::before {  content: "🌊"; position: absolute;  top: -40px;  left: 10px;  font-size: 64px;  color: rgba(255, 255, 255, 0.7);  
}  .login-container::after {  content: "🖌️";  position: absolute;  bottom: -40px;  right: 10px;  font-size: 64px;  color: rgba(255, 255, 255, 0.7);  
}

JavaScript (script.js):

document.getElementById('login-form').addEventListener('submit', function(event) {event.preventDefault(); // 防止表单提交及页面刷新// 模拟登录验证const message = document.getElementById('message');message.textContent = '登录成功!欢迎!';message.style.color = 'green';// 可以在此处添加进一步的验证和操作
});

第五款–赛博朋克


HTML:

<!DOCTYPE html>  
<html lang="zh">  
<head>  <meta charset="UTF-8">  <meta name="viewport" content="width=device-width, initial-scale=1.0">  <link rel="stylesheet" href="styles.css">  <title>赛博朋克登录页面</title>  
</head>  
<body>  <div class="background">  <div class="login-container">  <h1>欢迎回来</h1>  <form id="login-form">  <input type="text" placeholder="用户名" required>  <input type="password" placeholder="密码" required>  <button type="submit">登录</button>  </form>  <div id="message" class="message"></div>  </div>  </div>  <script src="script.js"></script>  
</body>  
</html>

CSS (styles.css):

body {  margin: 0;  font-family: 'Arial', sans-serif;  color: #fff;  
}  .background {  height: 100vh;  background-image: url('img/1.png'); background-size: cover;  background-position: center;  position: relative;  display: flex;  justify-content: center;  align-items: center;  filter: brightness(0.8);
}  .login-container {  width: 360px;  padding: 30px;  background: rgba(30, 30, 30, 0.9); border-radius: 10px;  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);  text-align: center;  position: relative;  border: 2px solid #7a2dbd; 
}  h1 {  font-size: 28px;  margin-bottom: 20px;  color: #5426ea;   
}  input {  width: 100%;  padding: 12px;  margin: 15px 0;  border: 2px solid #984b9b;border-radius: 5px;  font-size: 16px;  background-color: #1a1a1a; color: #fff; box-sizing: border-box;   }  input::placeholder {  color: #ccc; /* 占位符颜色 */  
}  button {  padding: 12px;  width: 100%;  background-color: #6e0f9a;   color: black; border: none;  border-radius: 5px;  cursor: pointer;  font-size: 18px;  transition: background-color 0.3s;  
}  button:hover {  background-color: #b82199; 
}  .message {  margin-top: 15px;  color: red;  
}  .login-container::before {  content: "⚙️"; position: absolute;  top: -35px;  left: 10px;  font-size: 48px;  color: #751086;  
}  .login-container::after {  content: "🌌";position: absolute;  bottom: -35px;  right: 10px;  font-size: 48px;  color: #b22b6f;  
}

JavaScript (script.js):

document.getElementById('login-form').addEventListener('submit', function(event) {event.preventDefault(); // 防止表单提交及页面刷新// 模拟登录验证const message = document.getElementById('message');message.textContent = '登录成功!欢迎回来。';message.style.color = 'green';// 在这里可以添加进一步的验证和操作
});

第六款–像素风格


HTML:

<!DOCTYPE html>  
<html lang="zh">  
<head>  <meta charset="UTF-8">  <meta name="viewport" content="width=device-width, initial-scale=1.0">  <link rel="stylesheet" href="styles.css">  <title>像素动漫风登录页面</title>  
</head>  
<body>  <div class="background">  <div class="login-container">  <h1>欢迎回来</h1>  <form id="login-form">  <input type="text" placeholder="用户名" required>  <input type="password" placeholder="密码" required>  <button type="submit">登录</button>  </form>  <div id="message" class="message"></div>  </div>  </div>  <script src="script.js"></script>  
</body>  
</html>

CSS (styles.css):

body {  margin: 0;  font-family: 'Pixel', 'Arial', sans-serif;  background-color: #282c34;  color: #fff;  overflow: hidden;  
}  .background {  height: 100vh;  display: flex;  justify-content: center;  align-items: center;  background-image: url('img/1.png'); background-size: cover;  
}  .login-container {  width: 400px;  padding: 30px;  background: rgba(30, 30, 30, 0.8);  border-radius: 15px;  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);  text-align: center;  border: 3px solid #ff66a3; h1 {  font-size: 32px;  margin-bottom: 20px;  color: #ff66a3; text-shadow: 2px 2px #ff0066;
}  input {  width: 100%;  padding: 12px;  margin: 15px 0;  border: 2px solid #ff66a3; border-radius: 5px;  font-size: 18px;  background-color: #1a1a1a; color: #fff; box-sizing: border-box; 
}  input::placeholder {  color: #ccc; 
}  button {  padding: 12px;  width: 100%;  background-color: #ff66a3; color: black; border: none;  border-radius: 5px;  cursor: pointer;  font-size: 20px;  transition: background-color 0.3s;  
}  button:hover {  background-color: #ff007f; 
}  .message {  margin-top: 15px;  color: #ffcc00;  
}  /* 像素动漫装饰 */  
.login-container::before {  content: "👾";   position: absolute;  top: -50px;  left: 20px;  font-size: 64px;  
}  .login-container::after {  content: "🌟";  position: absolute;  bottom: -50px;  right: 20px;  font-size: 64px;  
}

JavaScript (script.js):

document.getElementById('login-form').addEventListener('submit', function(event) {event.preventDefault(); // 防止表单提交及页面刷新// 模拟登录验证const message = document.getElementById('message');message.textContent = '登录成功!欢迎回来!';message.style.color = '#66ff66'; // 成功信息颜色// 在这里可以添加进一步的验证和操作
});

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

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

相关文章

【前端】六款高颜值注册界面

原创 吴旭东 无限大infinity 和昨天的一样,带来了六款注册界面,可复制源码(需要定制请加微信) 第一款–简约风格HTML: <!DOCTYPE html> <html lang="zh"> <head> <meta charset="UTF-8"> <meta name="viewport…

硬盘开机报错是什么原因引起的

硬盘开机报错可能由多种原因引起,以下是一些常见的原因及相应的解决方法: 一、硬件连接问题 数据线松动或损坏: 外部硬盘:检查USB线是否插紧,尝试更换USB线或连接到其他USB端口。 内部硬盘:检查数据线和电源线是否牢固连接,确保没有松动。 接口灰尘或损坏: 清洁主板上的…

PHPStudy 安装tp8 php8.1.3 安装XDbug、redis扩展

1.1 下载php安装包 https://windows.php.net/download/1.2 下载的的安装包1.3 解压 解压到D:\phpstudypro\Extensions\php\php8.1.3nts1.4 修改php8.1.3的php.ini文件 将php8.1.3nts目录下的php.ini-development文件复职一份并改文件名为 php.ini 。然后可以将php.ini里面的内容…

pyspark建模(类似于dwd层),flask直接对接前端请求进行召回(类似于ads层,但是不保存)

2. Spark MLib 2.1 Spark MLib 开发环境准备 2.1.1 配置python和spark环境 安装Python环境 安装Anaconda3-5.2.0-Windows-x86_64.exe配置环境变量Anaconda_HOME E:\20241014_Soft\Anaconda3PATH %Anaconda_HOME%Scripts;%Anaconda_HOME%Library\mingw-w64\bin;%Anaconda_HOME…

征程 6E camera diag sample

01 功能概述 本文的 demo sample 主要描述当前 camera 相关外设诊断的当前状态,并提供自定义实现的方法及使用说明。 1.1 软件架构说明 本 sample 基于现已实现的 camera 诊断架构,libcam 内的外设诊断功能对外设硬件状态进行监测,并支持将故障状态发送给 MCU 处理,或通过事…

实时数仓及olap可视化构建(基于mysql,将maxwell改成seatunnel可以快速达成异构数据源实时同步)

1. OLAP可视化实现(需要提前整合版本)Linux121 Linux122 Linux123jupyter✔spark ✔ ✔ ✔python3+SuperSet3.0✔hive✔ClinckHouse✔Kafka ✔ ✔ ✔Phoenix ✔DataX ✔maxwell✔Hadoop ✔ ✔ ✔MySQL✔ZK ✔ ✔ ✔HBASE ✔ ✔ ✔1.1 安装Vmware,安装虚拟机集群 1.1.1 安装 …

AI运动小程序开发常见问题集锦二

截止到现在写博文时,我们的AI运动识别小程序插件已经迭代了23个版本,成功应用于健身、体育、体测、AR互动等场景;为了让正在集成或者计划进行功能扩展优化的用户,少走弯路、投入更少的开发资源,针对近期的咨询问题,我们又归集了一些常见问题,供大家参考。一、计时、计数…

synchronized的monitor监视器

public class T {@SneakyThrowspublic static void main(String[] args) {System.out.println("此行后加锁 monitorenter");synchronized (T.class){System.out.println("hello monitor");}System.out.println("此行前释放锁 monitorexit");}}反…

31 计算机安全

计算机安全是保护系统和数据的,完整,保密,可用 保密:有权限的人才能读取数据;泄露信息就是攻击保密性(看不看得到)---窃取信息 完整性:能够修改数据,知道密码进入操作-----------------------------------获取权限 可用性:有权限的人应该能随时访问,黑客发大量请求到…

大话USB PD快充电源功率“协商”

啥叫USB PD快充技术? USB PD快充技术就是通过USB接口对对USB设备进行快速充电的一项技术。 由于USB技术的发展,特别的USB TYPE-C接口的广泛应用,基于USB TYPE-C接口的USB PD快充技术越来越成为主流。 使用USB TYPE-C接口的技术可以给谁充电?可以给我们的手机充电 可以给笔记…

瑞芯微RK3568开发板Linux编译报错404怎么办触觉智能教你轻松解决

本文介绍瑞芯微RK3568主板/开发板SDK编译流程和编译报错的解决方法,使用触觉智能EVB3568鸿蒙开发板演示,具有丰富的视频输入输出接口(HDMI/eDP/MIPI/LVDS) 与多种高速接口(千兆网口/PCIe/SATA/CAN等)。近期,触觉智能即将发布RK3568系列开源鸿蒙OpenHarmony5.0系统固件,敬…

网络流建图汇总

Dining G 一个点有两重限制,将点放中间,两边分别放两个限制,中间点点拆点连 1 表示限制 CTSC1999 家园 / 星际转移问题 时间限制可以分层图,分层图不需二分,直接一层层建即可 企鹅游行 这种有限制的拆点就完了。 猪 时序问题按照时间建即可。 一般出现调整的可以考虑把调整…