广州总部电话:020-85564311
广州总部电话:020-85564311
20年
互联网应用服务商
请输入搜索关键词
知识库 知识库

优网知识库

探索行业前沿,共享知识宝库

前端必备!CSS毛玻璃效果登录界面源码分享

发布日期:2025-04-14 20:27:32 浏览次数: 943 来源:程序员新视界

【本文效果抢先看】? 上滑查看完整代码
✨ 渐变背景与磨砂质感的完美碰撞
✨ 移动端优先的响应式布局方案
✨ 自带输入框动态交互的细节优化
✨ 一键复制即用的完整CSS代码 

效果


HTML

<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="UTF-8">
    <title>毛玻璃登录界面</title>
    <link rel="stylesheet" href="./css/index.css">
</head>

<body>
    <div class="glass">
        <form class="login-form">
            <h2>欢迎登录</h2>
            <div class="input-group">
                <input type="text" placeholder="用户名" required>
            </div>
            <div class="input-group">
                <input type="password" placeholder="密码" required>
            </div>
            <button type="submit">立即登录</button>
            <div class="links">
                <a href="#">注册账号</a>
                <a href="#">忘记密码?</a>
            </div>
        </form>
    </div>
</body>

</html>

CSS

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body{
    min-height: 100vh;
    background:linear-gradient(45deg, #ff6b6b, #4ecdc4);
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

.glass{
    background:rgba(255, 255, 255, 0.1);
    backdrop-filter:blur(10px);
    -webkit-backdrop-filter:blur(10px);
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 8px 32px 0 rgba(52, 57, 120, 0.37);
    padding: 40px;
    width: 400px;
    position: relative;
}

.login-form{
    color: white;
}

h2{
    text-align: center;
    margin-bottom: 30px;
    font-size: 2em;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.input-group{
    margin-bottom: 25px;
}

input{
    width: 100%;
    padding: 15px;
    background:rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    color: white;
    font-size: 16px;
    transition: all 0.3s;
}

input:focus{
    outline: none;
    background:rgba(255, 255, 255, 0.2);
    border-color:rgba(255, 255, 255, 0.5);
}

input::placeholder{
    color:rgba(255, 255, 255, 0.7);
}

button{
    width: 100%;
    padding: 15px;
    background:linear-gradient(45deg, #ff6b6b, #ff8e8e);
    border: none;
    border-radius: 8px;
    color: white;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s;
}

button:hover{
    transform:translateY(-2px);
    box-shadow: 0 5px 15px rgba(255, 107, 107, 0.4);
}

.links{
    margin-top: 20px;
    display: flex;
    justify-content: space-between;
}

a{
    color:rgba(255, 255, 255, 0.8);
    text-decoration: none;
    font-size: 14px;
}

a:hover{
    color: white;
}

优网科技,优秀企业首选的互联网供应服务商

优网科技秉承"专业团队、品质服务" 的经营理念,诚信务实的服务了近万家客户,成为众多世界500强、集团和上市公司的长期合作伙伴!

优网科技成立于2001年,擅长网站建设、网站与各类业务系统深度整合,致力于提供完善的企业互联网解决方案。优网科技提供PC端网站建设(品牌展示型、官方门户型、营销商务型、电子商务型、信息门户型、DIY体验、720全景展厅及3D虚拟仿真)、移动端应用(手机站APP开发)、微信定制开发(微信官网、微信商城、企业微信)、微信小程序定制开发等一系列互联网应用服务。


我要投稿

姓名

文章链接

提交即表示你已阅读并同意《个人信息保护声明》

专属顾问 专属顾问
扫码咨询您的优网专属顾问!
专属顾问
马上咨询
联系专属顾问
联系专属顾问
联系专属顾问
扫一扫马上咨询
扫一扫马上咨询

扫一扫马上咨询

和我们在线交谈!