15. 登录页案例

html 复制代码
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>登录页案例</title>
    <style>
      body {
        margin: 0;
        padding: 0;
        display: flex;
        align-items: center;
        justify-content: center;
        height: 100vh;
        overflow: hidden;
        background: linear-gradient(to right, #ffd194, #70e1f5);
      }
      .login-container {
        background-color: rgba(255, 255, 255, 0.5);
        border-radius: 8px;
        box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
        width: 400px;
        padding: 40px;
        block-size: border-box;
        text-align: center;
      }
      .login-container:hover {
        background-color: rgba(255, 255, 255, 0.9);
      }
      .login-container h1 {
        color: #333;
        margin-bottom: 30px;
        font-size: 24px;
        transition: color 0.3s ease;
      }
      .login-container:hover h1 {
        color: #555;
      }
      .login-input-container {
        position: relative;
        margin-bottom: 20px;
      }
      .login-input {
        width: calc(100% - 30px);
        padding: 15px;
        border: none;
        border-bottom: 2px solid #3498db;
        border-radius: 4px;
        box-sizing: border-box;
        font-size: 16px;
        color: #333;
        background-color: transparent;
        transition: border-color 0.3s ease;
      }
      .login-input:focus,
      .login-input:valid {
        border-color: red;
        outline: none;
      }
      .input-label {
        position: absolute;
        left: 15px;
        top: 18px;
        color: #999;
        font-size: 16px;
        pointer-events: none;
        transition: top 0.3s ease, font-size 0.3s ease, color 0.3s ease;
      }
      .login-input:focus ~ .input-label,
      .login-input:valid ~ .input-label {
        top: -5px;
        font-size: 12px;
        color: #2980b9;
      }
      .login-button {
        width: 200px;
        background-color: #3498db;
        color: #fff;
        padding: 10px 15px;
        border: none;
        border-radius: 20px;
        cursor: pointer;
        font-size: 18px;
        transition: background-color 0.3s ease;
      }
      .login-button:hover {
        background-color: #2980b9;
      }
    </style>
  </head>
  <body>
    <div class="login-container">
      <h1>账号密码登录</h1>
      <form action="#" method="post">
        <div class="login-input-container">
          <input class="login-input" type="text" name="username" required />
          <label class="input-label">username</label>
        </div>
        <div class="login-input-container">
          <input class="login-input" type="password" name="password" required />
          <label class="input-label">password</label>
        </div>
        <button class="login-button" type="submit">Login</button>
      </form>
    </div>
  </body>
  <script></script>
</html>
相关推荐
杨超越luckly7 小时前
HTML应用指南:利用GET请求获取中国500强企业名单,揭秘企业增长、分化与转型的新常态
前端·数据库·html·可视化·中国500强
夏幻灵9 小时前
CSS三大特性:层叠、继承与优先级解析
前端·css
会编程的土豆1 天前
新手前端小细节
前端·css·html·项目
周航宇JoeZhou1 天前
JB2-7-HTML
java·前端·容器·html·h5·标签·表单
代码小库1 天前
【课程作业必备】Web开发技术HTML静态网站模板 - 校园动漫社团主题完整源码
前端·html
云计算DevOps-韩老师1 天前
HTML 中的行级元素(inline)、块级元素(block)、行内块元素(inline-block)
html
珹洺1 天前
Bootstrap-HTML(二)深入探索容器,网格系统和排版
前端·css·bootstrap·html·dubbo
BillKu1 天前
VS Code HTML CSS Support 插件详解
前端·css·html
咔咔一顿操作1 天前
轻量无依赖!autoviwe 页面自适应组件实战:从安装到源码深度解析
javascript·arcgis·npm·css3·html5
HetFrame1 天前
一种纯前端实现 Markdown 内容即时分享的思路
html·react·链接·markdown·工具