zdpcss_transparent_login:不需要背景图,生成一个半透明的炫酷登录界面

废话不多说,先上图,有图有真相:
在这里插入图片描述

需要注意的是,这里的背景是使用CSS进行渲染的,而不是需要UI帮我们设计的背景图。

这种半透明的登录界面还是比较炫酷的,和之前的黑客登录界面比起来,各有优点,适合不同的场景。比如这个就看上去科技感比较足,而且比较正式,适合大部分的登录界面。

那么这种登录效果是怎么实现的呢?

还是先看看背景。和黑客登录界面不一样的是,这里的背景元素十分的简单:

<!--背景开始-->
<div class="background">
    <div class="shape"></div>
    <div class="shape"></div>
</div>
<!--背景结束-->

是不是特别的简单呢?只有两个shape元素,这个shape元素就是登录界面的背景图里面看到的那俩个圆。

背景样式对应的CSS代码如下:

/*背景样式开始*/
.background {
    width: 430px;
    height: 520px;
    /*让背景变为据对定位,这样就能够和登录表单在同一个平面上,形成背景效果*/
    position: absolute;
    transform: translate(-50%, -50%);
    left: 50%;
    top: 50%;
}

.background .shape {
    height: 200px;
    width: 200px;
    /*让元素变为据对定位,方便调整位置*/
    position: absolute;
    border-radius: 50%;
}

.shape:first-child {
    /*渐变色效果*/
    background: linear-gradient(
            #1845ad,
            #23a2f6
    );
    left: -80px;
    top: -80px;
}

.shape:last-child {
    background: linear-gradient(
            to right,
            #ff512f,
            #f09819
    );
    right: -30px;
    bottom: -80px;
}

/*背景样式结束*/

然后来看看登录表单的页面结构:

<!--登录表单开始-->
<form>
    <h3>用户登录</h3>
    <label for="username">账号</label>
    <input type="text" placeholder="请输入用户名" name="username" id="username">
    <label for="password">密码</label>
    <input type="password" placeholder="请输入密码" name="password" id="password">
    <button>登录</button>
    <div class="social">
        <div class="go"><i class="fab fa-google"></i> 微信登录</div>
        <div class="fb"><i class="fab fa-facebook"></i> QQ 登录</div>
    </div>
</form>
<!--登录表单结束-->

最后是登录表单的CSS样式:

/*登录表单样式开始*/
form {
    height: 520px;
    width: 400px;
    background-color: rgba(255, 255, 255, 0.13);
    position: absolute;
    transform: translate(-50%, -50%);
    top: 50%;
    left: 50%;
    border-radius: 10px;
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 0 40px rgba(8, 7, 16, 0.6);
    padding: 50px 35px;
}

form * {
    font-family: 'Poppins', sans-serif;
    color: #ffffff;
    letter-spacing: 1px;
    outline: none;
    border: none;
}

form h3 {
    font-size: 32px;
    font-weight: 500;
    line-height: 42px;
    text-align: center;
}

label {
    display: block;
    margin-top: 30px;
    font-size: 16px;
    font-weight: 500;
}

input {
    display: block;
    height: 50px;
    width: 100%;
    background-color: rgba(255, 255, 255, 0.07);
    border-radius: 3px;
    padding: 0 10px;
    margin-top: 8px;
    font-size: 14px;
    font-weight: 300;
}

::placeholder {
    color: #e5e5e5;
}

button {
    margin-top: 50px;
    width: 100%;
    background-color: #ffffff;
    color: #080710;
    padding: 15px 0;
    font-size: 18px;
    font-weight: 600;
    border-radius: 5px;
    cursor: pointer;
}

.social {
    margin-top: 30px;
    display: flex;
}

.social div {
    width: 150px;
    border-radius: 3px;
    padding: 5px 10px 10px 5px;
    background-color: rgba(255, 255, 255, 0.27);
    color: #eaf0fb;
    text-align: center;
}

.social div:hover {
    background-color: rgba(255, 255, 255, 0.47);
}

.social .fb {
    margin-left: 25px;
}

.social i {
    margin-right: 4px;
}
/*登录表单样式结束*/

最终,我们就能够得到一个比较炫酷的半透明登录界面了:
在这里插入图片描述

如果需要完整的代码,可以私信我哦。如果对您有帮助,麻烦记得打赏一下。

最近更新

  1. TCP协议是安全的吗?

    2024-04-07 18:14:01       16 阅读
  2. 阿里云服务器执行yum,一直下载docker-ce-stable失败

    2024-04-07 18:14:01       16 阅读
  3. 【Python教程】压缩PDF文件大小

    2024-04-07 18:14:01       15 阅读
  4. 通过文章id递归查询所有评论(xml)

    2024-04-07 18:14:01       18 阅读

热门阅读

  1. 客户主数据冻结

    2024-04-07 18:14:01       17 阅读
  2. MySQL中日期有关函数

    2024-04-07 18:14:01       23 阅读
  3. 54.螺旋矩阵

    2024-04-07 18:14:01       16 阅读
  4. C++ P1152 欢乐的跳

    2024-04-07 18:14:01       11 阅读
  5. LeetCode-热题100:45. 跳跃游戏 II

    2024-04-07 18:14:01       16 阅读
  6. 前端八股文--js系列

    2024-04-07 18:14:01       15 阅读
  7. Go如何并发访问内存

    2024-04-07 18:14:01       42 阅读
  8. 蓝桥杯每日一题(快速幂、组合计数)

    2024-04-07 18:14:01       15 阅读
  9. Anaconda 安装pytorch 问题

    2024-04-07 18:14:01       17 阅读
  10. 使用深度学习识别英文字母和数字

    2024-04-07 18:14:01       46 阅读