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

前端的测试

<!DOCTYPE html>
<html lang="zh-CN">
<head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>用户登录</title><script src="https://cdn.tailwindcss.com"></script>  //引入外部资源<link href="https://cdn.jsdelivr.net/npm/font-awesome@4.7.0/css/font-awesome.min.css" rel="stylesheet"><script>#Tailwind CSS配置tailwind.config = {theme: {extend: {colors: {primary: '#165DFF',    //主色调(蓝色)secondary: '#4080FF',neutral: '#F5F7FA',dark: '#1D2129',},fontFamily: {inter: ['Inter', 'system-ui', 'sans-serif'],},},}}</script><style type="text/tailwindcss">#自定义CSS工具类@layer utilities {.content-auto {content-visibility: auto;}.card-shadow {    //卡片阴影效果box-shadow: 0 10px 30px -5px rgba(0, 0, 0, 0.1);}.input-focus {   	//输入框获得焦点时的样式@apply focus:border-primary focus:ring-2 focus:ring-primary/20 focus:outline-none;}.btn-hover { 	//按钮悬停动画效果(轻微上浮+阴影加深)@apply hover:shadow-lg hover:-translate-y-0.5 transition-all duration-300;}}</style>
</head><body class="font-inter bg-gradient-to-br from-neutral to-gray-100 min-h-screen flex items-center justify-center p-4">
// min-h-screen : 确保页面至少占满整个屏幕高度
// flex items-center justify-center : 使用Flex布局将登录卡片居中
//max-w-md : 限制卡片最大宽度,在大屏幕上不会太宽
//rounded-2xl : 卡片圆角设计,现代感更强<div class="w-full max-w-md"><!-- 登录卡片 --><div class="bg-white rounded-2xl p-8 card-shadow transform transition-all duration-500 hover:shadow-xl"><!-- 标题区域 --><div class="text-center mb-8"><h1 class="text-[clamp(1.5rem,3vw,2rem)] font-bold text-dark mb-2">欢迎回来</h1><p class="text-gray-500">请登录您的账号</p></div><!-- 登录表单 --><form id="loginForm" class="space-y-6"><!-- 用户名输入框 --><div class="space-y-2"><label for="username" class="block text-sm font-medium text-gray-700">账号</label><div class="relative"><div class="absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none text-gray-400"><i class="fa fa-user"></i></div>     <input type="text" id="username" name="username" required   class="w-full pl-10 pr-4 py-3 border border-gray-300 rounded-lg input-focus"placeholder="请输入账号">            //required : HTML5表单验证,确保用户必须填写</div> </div><!-- 密码输入框 --><div class="space-y-2"><label for="password" class="block text-sm font-medium text-gray-700">密码</label><div class="relative"><div class="absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none text-gray-400"><i class="fa fa-lock"></i></div><input type="password" id="password" name="password" requiredclass="w-full pl-10 pr-10 py-3 border border-gray-300 rounded-lg input-focus"placeholder="请输入密码"><button type="button" id="togglePassword" class="absolute inset-y-0 right-0 pr-3 flex items-center text-gray-400 hover:text-primary"><i class="fa fa-eye-slash"></i></button></div></div><!-- 记住我和忘记密码 --><div class="flex items-center justify-between"><div class="flex items-center"><input id="remember-me" name="remember-me" type="checkbox"class="h-4 w-4 rounded border-gray-300 text-primary focus:ring-primary"><label for="remember-me" class="ml-2 block text-sm text-gray-700">记住我</label></div><div class="text-sm"><a href="#" class="font-medium text-primary hover:text-secondary">忘记密码?</a></div></div><!-- 登录按钮 --><div><button type="submit"class="w-full flex justify-center py-3 px-4 border border-transparent rounded-lg shadow-sm text-sm font-medium text-white bg-primary hover:bg-primary/90 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-primary btn-hover">登录</button></div></form><!-- 注册链接 --><div class="mt-6 text-center text-sm text-gray-600">还没有账号? <a href="#" class="font-medium text-primary hover:text-secondary">立即注册</a></div></div></div><!-- JavaScript --><script>// 密码显示/隐藏切换const togglePassword = document.getElementById('togglePassword');const passwordInput = document.getElementById('password');togglePassword.addEventListener('click', function() {// 切换密码可见性const type = passwordInput.getAttribute('type') === 'password' ? 'text' : 'password';passwordInput.setAttribute('type', type);  //通过修改 type 属性切换密码框显示状态// 切换图标this.querySelector('i').classList.toggle('fa-eye');  //使用 classList.toggle() 切换图标this.querySelector('i').classList.toggle('fa-eye-slash');});// 表单提交处理const loginForm = document.getElementById('loginForm');loginForm.addEventListener('submit', function(e) {e.preventDefault();   //e.preventDefault() : 阻止页面刷新const username = document.getElementById('username').value;const password = document.getElementById('password').value;// 在实际应用中,这里会发送登录请求到服务器alert(`账号: ${username}\n密码: ${password}\n\n登录功能已触发,实际应用中会发送请求到服务器`);});</script>
</body>
</html>
: 声明文档类型为HTML5: HTML根元素, lang="zh-CN" 表示页面使用中文: 包含页面元数据(如字符集、标题)和外部资源: 包含用户可见的页面内容
http://www.xdnf.cn/news/15833.html

相关文章:

  • 如何实战优化SEO关键词提升百度排名?
  • 深度学习图像分类数据集—百种病虫害分类
  • 【KDD2025】时间序列|Merlin:不固定缺失率下时间序列预测新SOTA!
  • C++ - 仿 RabbitMQ 实现消息队列--服务端核心模块实现(一)
  • 服务器上的文件复制到本地 Windows 系统
  • python网络爬虫小项目(爬取评论)超级简单
  • git fork的项目远端标准协作流程 仓库设置[设置成upstream]
  • 快速上手git
  • LINUX入门(二)QT的安装及运行环境搭建
  • 【实习总结】Qt中如何使用QSettings操作.ini配置文件
  • Vue中组件的生命周期
  • 08_Opencv_基本图形绘制
  • Docker实战:使用Docker部署envlinks极简个人导航页
  • 激光雷达和相机在线标定
  • [C/C++安全编程]_[中级]_[如何安全使用循环语句]
  • 语言学校为何成为IT润日路径的制度跳板?签证与迁移结构的工程化拆解
  • 交通出行大前端与 AI 融合:智能导航与出行预测
  • 智能制造——48页毕马威:汽车营销与研发数字化研究【附全文阅读】
  • jxORM--编程指南
  • linux + 宝塔面板 部署 django网站 启动方式:uwsgi 和gunicorn如何选择 ?
  • windows命令提示符cmd使用
  • Django接口自动化平台实现(四)
  • 第 30 场 蓝桥·算法入门赛 题解
  • 制作mac 系统U盘
  • 零基础学习性能测试第一章-为什么会有性能问题
  • 全面解析 JDK 提供的 JVM 诊断与故障处理工具
  • VSCode使用Jupyter完整指南配置机器学习环境
  • 秒赤Haproxy配置算法
  • `TransportService` 是 **Elasticsearch 传输层的“中枢路由器”**
  • SparseTSF:用 1000 个参数进行长序列预测建模