用html画一个比较好看的登陆页面

这是一个展示如何使用HTML和CSS构建简单登录页面的代码片段。页面包含一个表单,用户可输入用户名和密码,输入框具有定制的样式,提交按钮在点击时改变背景颜色。页面设计注重用户体验,元素对齐和交互效果清晰。
摘要由CSDN通过智能技术生成

下面是一个简单的登录页面的HTML代码:

<!DOCTYPE html>
<html>
<head>
  <title>登录页面</title>
  <style>
    /* 添加样式 */
    .container {
      width: 500px;
      margin: 0 auto;
      text-align: center;
    }
    input[type="text"], input[type="password"] {
      width: 100%;
      padding: 12px 20px;
      margin: 8px 0;
      box-sizing: border-box;
      border: 2px solid #ccc;
      border-radius: 4px;
    }
    input[type="submit"] {
      width: 100%;
      background-color: #4CAF50;
      color: white;
      padding: 14px 20px;
      margin: 8px 0;
      border: none;
      border-radius: 4px;
      cursor: pointer;
    }
    input[type="submit"]:hover {
      background-color: #45a049;
    }
  </style>
</head>
<body>
  <div class="container">
    <h2>登录</h2>
    <form action="/login" method="post">
      <label for="username">用户名</label>
      <input type="text" id="username" name="username" required>
      <br>
      <label for="password">密码</label>
      <input type="password" id="password" name="password" required>
      <br>
      <input type="submit" value="登录">
    </form>
  </div>
</body>
</html>

该登录页面由一个表单构成,包括用户名和密码两个输入框以及一个提交按钮。通过 <label> 标签和 for 属性将每个输入框与其相应的标签相关联。通过 CSS 样式,可以调整输入框的外观和按钮的样式。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值