掘金可爱的登录效果

简介: 我来分享代码了

效果预览


c507df229ca74274870a6bb12fa66909 (1).gif


在线访问

链接


文件目录


7fc6df6cdc4f412f8c15d96266e97d5f (1).png


图片素材


素材

素材


html


<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>掘金登录小案例</title>
    <!-- bootstrap4图标库引入 -->
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.8.1/font/bootstrap-icons.css">
    <!-- css文件引入 -->
    <link rel="stylesheet" href="./index.css">
    <!-- 网站图标 -->
    <link rel="shortcut icon" href="http://zhouql.vip/images/tou/t1.png" type="image/x-icon">
</head>
<body>
    <div id="app">
        <form action="" method="get">
            <button></button>
            <h2>手机登录</h2>
            <p><input type="text" name="" autofocus id="phone" placeholder="请输入手机号"></p>
            <p><input type="password" name="" id="pwd" placeholder="验证码"></p>
            <p><input type="submit" value="登录"></p>
            <a href="">其他登录方式</a>
            <p><span>注册登录即表示同意 <small>用户协议,隐私政策</small></span></p>
        </form>
        <img class="t1" src="./images/4f6f6f316cde4398d201cd67e44ddea3.svg" alt="">
        <img class="t2" src="./images/500c1180a96859e5c54a5359f024a397.svg" alt="">
    </div>
    <script>
        document.querySelector('#phone').addEventListener('focus',function(){
            document.querySelector('.t2').style.display = "block";
        });
        document.querySelector('#phone').addEventListener('blur',function(){
            document.querySelector('.t2').style.display = "none";
        });
        document.querySelector('#pwd').addEventListener('focus',function(){
            document.querySelector('.t1').style.display = "block";
        });
        document.querySelector('#pwd').addEventListener('blur',function(){
            document.querySelector('.t1').style.display = "none";
        });
        document.querySelector('button').addEventListener('click',function(e){
            document.body.style.backgroundColor = "#fff";
            document.querySelector('#app').style.display = "none";
            e.preventDefault();
        });
    </script>
</body>
</html>


css


*{
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}
body{
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background-color: #aaabab;
}
#app{
    position: relative;
    height: 290px;
    width: 350px;
    background-color: #fff;
}
#app form{
    position: relative;
    padding: 20px;
}
#app form h2{
    color: #333333;
    font-size: 18px;
    user-select: none;
}
#app form p input{
    width: 100%;
    height: 38px;
    color: #828282;
    border: 1px solid #ddd;
    padding-left: 8px;
    margin-top: 18px;
    border-radius: 2px;
    outline: none;
}
#app form p:nth-of-type(3) input{
    background-color: #007fff;
    color: #edf6ff;
}
#app form a{
    text-decoration: none;
    color: #198fff;
    margin: 10px 0;
    display: inline-block;
    font-size: 15px;
}
#app form p span{
    margin-top: 10px;
    font-size: 14px;
    color: #847f7a;
}
#app form p span small{
    font-size: 14px;
    color: #198fff;
}
button{
    position: absolute;
    top: 20px;
    right: 20px;
    border: none;
    background-color: transparent;
    cursor: pointer;
}
button::after{
    font-family: "bootstrap-icons";
    content: '\F62A';
    font-size: 24px;
    color: #afafaf;
}
#app img{
    position: absolute;
    width: 100px;
    left: 50%;
    transform: translateX(-50%);
    display: none;
}
#app img:nth-of-type(1){
    top: -64px;
}
#app img:nth-of-type(2){
    top: -62px;
}


相关文章
|
2月前
杨校老师课堂之DeDeCMS织梦后台目录介绍篇
杨校老师课堂之DeDeCMS织梦后台目录介绍篇
27 6
|
2月前
杨校老师课堂之编写验证码
杨校老师课堂之编写验证码
12 0
|
2月前
|
前端开发 JavaScript
杨老师课堂之JavaScript右下角广告弹框
杨老师课堂之JavaScript右下角广告弹框
20 0
|
3月前
祝福各位CSDN的小伙伴圣诞快乐
祝福各位CSDN的小伙伴圣诞快乐
小蚂蚁学员们的微信小游戏作品分享2
再分享一波我的学员的微信小游戏作品,厉害的学员越来越多了,上线的小游戏作品也越来越多了,靠小游戏赚到钱的学员也越来越多了。 大部分的学员都是从零开始的,通过学习做出了自己的第一个小游戏,通过接入流量主赚到了自己的第一份睡后收入,祝贺这些学员学有所成。🎉 下面这些小游戏都无需下载安装,点击小游戏名字,可以直接打开体验。欢迎大家去玩玩,支持一下我的学员们的游戏作品。
131 0
|
开发者
点这里,加小蚂蚁微信,交个朋友
简单的做个自我介绍,我是小蚂蚁,从事游戏开发行业有 8 年的时间,我从一个游戏开发的技术人员(也就是写代码的)转变成现在的一个独立的游戏开发者。
62 0
|
算法 C语言 Python
|
SQL XML 算法
程序员收藏夹里的常用网站,快来围观
程序员收藏夹里的常用网站,快来围观
225 0
程序员收藏夹里的常用网站,快来围观
|
存储 JSON 前端开发
如何盘点出掘金的年度高赞文章?
我的新年 Flag ,就是掘金等级到达 V4,而对于绝大多数读者来说,新年 Flag 中是否有“学习”这一项呢,对于我来说,我也是,于是就有萌生一个想法,我想统计出掘金的年度高赞文章。
338 1
|
存储 数据库
Axure实战24:创建一个掘金Lottery幸运抽奖工具
Axure实战24:创建一个掘金Lottery幸运抽奖工具
266 0
Axure实战24:创建一个掘金Lottery幸运抽奖工具