关于使用纯css写一个美观的登录页面

效果图:

标题 Please Login 是一个左右旋转的动画效果

代码如下: 

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>注册登录</title>
  <style>
    * {
      margin: 0;
      padding: 0;
      box-sizing: border-box;
      font-family: '微软雅黑';
      font-weight: 600;
    }
    body {
      width: 100vw;
      height: 100vh;
      background: linear-gradient(45deg, #57c5f7, #fff);
    }
    .form {
      width: 360px;
      height: 280px;
      position: relative;
      left: 50%;
      top: 25%;
      background: linear-gradient(to top, #fff, pink);
      border-radius: 15px;
      overflow: hidden;
      box-shadow:8.0px 16.0px 16.0px hsla(0, 0%, 15%, 0.25);
    }
    .form .form_title {
      text-align: center;
      margin-top: 30px;
      font-size: 22px;
      color: #17a19d;
      -webkit-animation: moveTitle 2s infinite linear;
    }
    .form .form_main {
      height: 100px;
      display: flex;
      flex-direction: column;
      justify-content: space-around;
      align-items: center;
      margin-top: 20px;
    }
    .form .form_main span {
      color: #17a19d;
    }
    .form .form_main_user .form_main_user_input {
      display: flex;
      border-bottom: 1px solid #17a19d;
      position: relative;
    }
    .form .form_main_user .form_main_user_input .icon {
      text-align: center;
      line-height: 30px;
      position: absolute;
      right: 2px;
    }
    .form .form_main_user .form_main_user_input .icon img {
      width: 14px;
      height: 14px;
      object-fit: cover;
    }
    .form .form_main input {
      width: 185px;
      height: 30px;
      padding-left: 8px;
      font-size: 14px;
      font-weight: 500;
      border: 0;
      outline: none;
      color: #17a19d;
      background-color: transparent;
      position: relative;
    }
    .form .form_main input::-webkit-input-placeholder {
      color: #17a19d;
    }
    .form .form_main .form_main_user {
      display: flex;
      align-items: center;
    }
    .form_btn {
      display: flex;
      justify-content: center;
      margin-top: 20px;
    }
    .form_btn button {
      height: 32px;
      width: 150px;
      line-height: 32px;
      font-size: 14px;
      padding: 0 15px;
      background-color: #17a19d;
      color: #fff;
      text-align: center;
      outline: none;
      border: 1px solid transparent;
      cursor: pointer;
      border-radius: 8px;
      white-space: nowrap;
      user-select: none;
    }
    .form .form_register {
      text-align: right;
      font-size: 12px;
      color: #17a19d;
      position: absolute;
      padding: 2px 3px;
      right: 10px;
      bottom: 10px;
      cursor: pointer;
      border-bottom: 1px solid #17a19d;
    }
    @keyframes moveTitle {
      20% {
		    -webkit-transform:rotate(15deg);
		  } 
      40% {
		    -webkit-transform:rotate(-15deg);
		  } 
      60% {
		    -webkit-transform:rotate(15deg);
		  }
      80% {
		    -webkit-transform:rotate(-15deg);
		  }
      100% {
		    -webkit-transform:rotate(0deg);
		  }
    }
  </style>
</head>
<body>
  <div class="form">
    <div class="form_title">
      Please Login
    </div>
    <div class="form_main">
      <div class="form_main_user">
        <span>username:</span>
        <div class="form_main_user_input">
          <input type="text" placeholder="Please Enter username" id="username">
          <div class="icon show">
            <img src="../../image/error.png" alt="">
          </div>
        </div>
      </div>
      <div class="form_main_user">
        <span>password:</span>
        <div class="form_main_user_input">
          <input type="password" placeholder="Please enter password" id="password">
          <div class="icon show">
            <img src="../../image/error.png" alt="">
          </div>
        </div>
      </div>
    </div>
    <div class="form_btn">
      <button id="btn">login</button>
    </div>
    <div class="form_register">Register Now!</div>
  </div>
</body>
</html>

喜欢的先收藏哦 

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值