简易登录页面

html

<body>
<div class="login">
    <div class="header">登录</div>
    <div class="container">
        <input type="text" placeholder="请输入用户名">
        <span class="left"></span>
        <span class="right"></span>
        <span class="top"></span>
        <span class="bottom"></span>
    </div>
    <div class="container1">
        <input type="password" placeholder="请输入密码">
        <span class="left"></span>
        <span class="right"></span>
        <span class="top"></span>
        <span class="bottom"></span>
    </div>
    <div class="btn">登录</div>
</div>
</body>

css

  * {
            margin: 0;
            padding: 0;
        }
        html, body {
            height: 100%;
            height: 100%;
        }
        .login {
            width: 358px;
            height: 588px;
            border-radius: 15px;
            padding: 0 50px;
            position: relative;
            left: 50%;
            top: 50%;
            transform: translate(-50%, -50%);
            background-color: #282c34;
        }
        .header{
        font-size:38px;
        font-weight:bold;
        text-align:center;
        line-height:200px;
        color:#61dafb;
        }
        .container{
        height:30px;
        width:250px;
        position:absolute;
        left:50%;
        top:40%;
        transform:translate(-50%,-50%);
        }
        input{
        width:100%;
        height:100%;
        position:relative;
        outline:none;
        border:none;
        box-sizing:border-box;
        padding-left:5px;
        background-color:#282c34;
        color:#61dafb;
        caret-color:#61dafb;
        }
        input::placeholder{
        color:#61dafb;
        }
        span{
        position:absolute;
        content:"";
        display:block;
        background-color:#61dafb;
        transition:transform .1s ease-in-out;
        }
        .top,
        .bottom{
        left:0px;
        right:0px;
        height:2px;
        }
        .left,
        .right{
        top:0px;
        bottom:0px;
        width:2px;
        transform:scaleY(0);
        }
        .top{
        top:0px;
        tranform:scaleX(0);
        transform-origin:left center;
        transition-delay:.2s;
        }
        .left{
        left:0px;
        transform-origin:bottom center;
        transition-delay:.3s;
        }
        .bottom{
        bottom:0px;
        }
        .right{
        right:0px;
        transform-origin:top center;
        transition-delay:.1s;
        }
         input:focus ~ .right {
            transform: scaleY(1);
            transform-origin: bottom center;
        }
        input:focus ~ .left {
            transform: scaleY(1);
            transform-origin: top center;
        }
        input:focus ~ .top {
            transform: scaleY(1);
            transform-origin: right center;
        }
        .container1 {
            height: 30px;
            width: 250px;
            position: absolute;
            left: 50%;
            top: 50%;
            transform: translate(-50%, -50%);
        }
        .btn {
            position: absolute;
            left: 50%;
            top: 54%;
            transform: translate(-50%, -50%);
            text-align: center;
            padding: 5px;
            width: 52%;
            margin-top: 40px;
            background-color: #61dafb;
            color: #fff;
        }

完整代码

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>练习</title>
    <style>
          * {
            margin: 0;
            padding: 0;
        }
        html, body {
            height: 100%;
            height: 100%;
        }
        .login {
            width: 358px;
            height: 588px;
            border-radius: 15px;
            padding: 0 50px;
            position: relative;
            left: 50%;
            top: 50%;
            transform: translate(-50%, -50%);
            background-color: #282c34;
        }
        .header{
        font-size:38px;
        font-weight:bold;
        text-align:center;
        line-height:200px;
        color:#61dafb;
        }
        .container{
        height:30px;
        width:250px;
        position:absolute;
        left:50%;
        top:40%;
        transform:translate(-50%,-50%);
        }
        input{
        width:100%;
        height:100%;
        position:relative;
        outline:none;
        border:none;
        box-sizing:border-box;
        padding-left:5px;
        background-color:#282c34;
        color:#61dafb;
        caret-color:#61dafb;
        }
        input::placeholder{
        color:#61dafb;
        }
        span{
        position:absolute;
        content:"";
        display:block;
        background-color:#61dafb;
        transition:transform .1s ease-in-out;
        }
        .top,
        .bottom{
        left:0px;
        right:0px;
        height:2px;
        }
        .left,
        .right{
        top:0px;
        bottom:0px;
        width:2px;
        transform:scaleY(0);
        }
        .top{
        top:0px;
        tranform:scaleX(0);
        transform-origin:left center;
        transition-delay:.2s;
        }
        .left{
        left:0px;
        transform-origin:bottom center;
        transition-delay:.3s;
        }
        .bottom{
        bottom:0px;
        }
        .right{
        right:0px;
        transform-origin:top center;
        transition-delay:.1s;
        }
         input:focus ~ .right {
            transform: scaleY(1);
            transform-origin: bottom center;
        }
        input:focus ~ .left {
            transform: scaleY(1);
            transform-origin: top center;
        }
        input:focus ~ .top {
            transform: scaleY(1);
            transform-origin: right center;
        }
        .container1 {
            height: 30px;
            width: 250px;
            position: absolute;
            left: 50%;
            top: 50%;
            transform: translate(-50%, -50%);
        }
        .btn {
            position: absolute;
            left: 50%;
            top: 54%;
            transform: translate(-50%, -50%);
            text-align: center;
            padding: 5px;
            width: 52%;
            margin-top: 40px;
            background-color: #61dafb;
            color: #fff;
        }
    </style>
</head>
<body>
<div class="login">
    <div class="header">登录</div>
    <div class="container">
        <input type="text" placeholder="请输入用户名">
        <span class="left"></span>
        <span class="right"></span>
        <span class="top"></span>
        <span class="bottom"></span>
    </div>
    <div class="container1">
        <input type="password" placeholder="请输入密码">
        <span class="left"></span>
        <span class="right"></span>
        <span class="top"></span>
        <span class="bottom"></span>
    </div>
    <div class="btn">登录</div>
</div>
</body>
</html>

效果图
在这里插入图片描述

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

佳美不ERROR

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值