当前位置: 首页 > article >正文

HTML+CSS 水滴登录页

文章目录

  • 一、效果演示
  • 二、Code
    • 1.HTML
    • 2.CSS
  • 三、实现思路拆分


一、效果演示

在这里插入图片描述

实现了一个水滴登录页的效果。页面包含一个水滴形状的登录框和两个按钮,登录框包括用户名、密码和登录按钮,按钮分别为忘记密码和注册。整个页面的设计非常有创意,采用了水滴形状和渐变色的设计,使得页面看起来非常美观和舒适。同时,登录框和按钮的动态效果也增强了页面的交互性和视觉效果。

二、Code

1.HTML

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>水滴登录页</title>
    <link rel="stylesheet" href="./68-水滴登录页.css">
</head>

<body>
    <div class="box">
        <div class="content">
            <h2>登录</h2>
            <div>
                <input type="text" placeholder="请输入用户名">
            </div>
            <div>
                <input type="password" placeholder="请输入密码">
            </div>
            <div>
                <input type="submit" value="登录">
            </div>
        </div>
        <a href="#" class="btns">忘记密码</a>
        <a href="#" class="btns register">注册</a>
    </div>
</body>

</html>

2.CSS

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

body {
    height: 100vh;
    background: #eff0f4;
    overflow: hidden;
}

.box {
    position: relative;
    display: flex;
    justify-content: space-between;
    margin: 150px auto;
    width: 470px;
}

.box .content {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    align-items: center;
    width: 350px;
    height: 350px;
    padding: 60px 20px;
    box-shadow: inset 20px 20px 20px rgba(0, 0, 0, 0.05),
        25px 35px 20px rgba(0, 0, 0, 0.05), 25px 30px 30px rgba(0, 0, 0, 0.05),
        inset -20px -20px 25px rgba(255, 255, 255, 0.9);
}

.box .content {
    border-radius: 52% 48% 33% 67% / 38% 45% 55% 62%;
    transition: 0.5s;
}

.box .content:hover {
    border-radius: 50%;
}

.box .content::before {
    content: "";
    position: absolute;
    top: 50px;
    left: 85px;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    background: #fff;
    opacity: 0.9;
}

.box .content::after {
    content: "";
    position: absolute;
    top: 90px;
    left: 110px;
    width: 15px;
    height: 15px;
    border-radius: 50%;
    background: #fff;
    opacity: 0.9;
}

.box .content div {
    position: relative;
    width: 225px;
    border-radius: 25px;
    box-shadow: inset 2px 5px 10px rgba(0, 0, 0, 0.1),
        inset -2px -5px 10px rgba(255, 255, 255, 1),
        15px 15px 10px rgba(0, 0, 0, 0.05), 15px 10px 15px rgba(0, 0, 0, 0.025);
}

.box .content div::before {
    content: "";
    position: absolute;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    width: 65%;
    height: 5px;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 5px;
}

.box .content input {
    width: 100%;
    border: none;
    outline: none;
    background: transparent;
    font-size: 16px;
    padding: 10px 15px;
}

.box .content input[type="submit"] {
    color: #fff;
    cursor: pointer;
}

.box .content div:last-child {
    width: 120px;
    background: #ff0f5b;
    box-shadow: inset 2px 5px 10px rgba(0, 0, 0, 0.1),
        15px 15px 10px rgba(0, 0, 0, 0.05), 15px 10px 15px rgba(0, 0, 0, 0.025);
    transition: 0.5s;
}

.box .content div:last-child:hover {
    width: 150px;
}

.btns {
    position: absolute;
    right: 0;
    bottom: 0;
    width: 120px;
    height: 120px;
    background: #c61dff;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    text-decoration: none;
    color: #fff;
    font-size: 14px;
    box-shadow: inset 10px 10px 10px rgba(190, 1, 254, 0.05),
        15px 25px 10px rgba(190, 1, 254, 0.1), 15px 20px 20px rgba(190, 1, 254, 0.1),
        inset -10px -10px 15px rgba(255, 255, 255, 0.5);
    border-radius: 44% 56% 65% 35% / 57% 58% 42% 43%;
}

.register {
    bottom: 150px;
    right: 0px;
    width: 80px;
    height: 80px;
    border-radius: 49% 51% 52% 48% / 63% 59% 41% 37%;
    background: #01b4ff;
    box-shadow: inset 10px 10px 10px rgba(1, 180, 255, 0.05),
        15px 25px 10px rgba(1, 180, 255, 0.1), 15px 20px 20px rgba(1, 180, 255, 0.1),
        inset -10px -10px 15px rgba(255, 255, 255, 0.5);
}

.btns::before {
    content: "";
    position: absolute;
    top: 15px;
    left: 30px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #fff;
    opacity: 0.45;
}

.register::before {
    left: 20px;
    width: 15px;
    height: 15px;
}

.btns {
    transition: 0.25s;
}

.btns:hover {
    border-radius: 50%;
}

三、实现思路拆分

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

重置所有元素的默认样式。

body {
    height: 100vh;
    background: #eff0f4;
    overflow: hidden;
}

设置页面的背景颜色和尺寸。

.box {
    position: relative;
    display: flex;
    justify-content: space-between;
    margin: 150px auto;
    width: 470px;
}

设置登录表单容器的布局、位置和尺寸。

.box .content {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    align-items: center;
    width: 350px;
    height: 350px;
    padding: 60px 20px;
    box-shadow: inset 20px 20px 20px rgba(0, 0, 0, 0.05),
        25px 35px 20px rgba(0, 0, 0, 0.05), 25px 30px 30px rgba(0, 0, 0, 0.05),
        inset -20px -20px 25px rgba(255, 255, 255, 0.9);
}

设置登录表单内容的样式,包括3D效果和过渡动画。

.box .content::before {
    content: "";
    position: absolute;
    top: 50px;
    left: 85px;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    background: #fff;
    opacity: 0.9;
}

.box .content::after {
    content: "";
    position: absolute;
    top: 90px;
    left: 110px;
    width: 15px;
    height: 15px;
    border-radius: 50%;
    background: #fff;
    opacity: 0.9;
}

创建伪元素以增强水滴效果。

.box .content div {
    position: relative;
    width: 225px;
    border-radius: 25px;
    box-shadow: inset 2px 5px 10px rgba(0, 0, 0, 0.1),
        inset -2px -5px 10px rgba(255, 255, 255, 1),
        15px 15px 10px rgba(0, 0, 0, 0.05), 15px 10px 15px rgba(0, 0, 0, 0.025);
}

设置输入框容器的样式,包括阴影和边框圆角。

.box .content input {
    width: 100%;
    border: none;
    outline: none;
    background: transparent;
    font-size: 16px;
    padding: 10px 15px;
}

设置输入框的基本样式。

.box .content input[type="submit"] {
    color: #fff;
    cursor: pointer;
}

为提交按钮设置特定的样式。

.btns {
    position: absolute;
    right: 0;
    bottom: 0;
    width: 120px;
    height: 120px;
    background: #c61dff;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    text-decoration: none;
    color: #fff;
    font-size: 14px;
    box-shadow: inset 10px 10px 10px rgba(190, 1, 254, 0.05),
        15px 25px 10px rgba(190, 1, 254, 0.1), 15px 20px 20px rgba(190, 1, 254, 0.1),
        inset -10px -10px 15px rgba(255, 255, 255, 0.5);
    border-radius: 44% 56% 65% 35% / 57% 58% 42% 43%;
}

设置忘记密码和注册按钮的样式,包括3D效果、阴影和过渡动画。

.register {
    bottom: 150px;
    right: 0px;
    width: 80px;
    height: 80px;
    border-radius: 49% 51% 52% 48% / 63% 59% 41% 37%;
    background: #01b4ff;
    box-shadow: inset 10px 10px 10px rgba(1, 180, 255, 0.05),
        15px 25px 10px rgba(1, 180, 255, 0.1), 15px 20px 20px rgba(1, 180, 255, 0.1),
        inset -10px -10px 15px rgba(255, 255, 255, 0.5);
}

为注册按钮设置特定的样式。

.btns::before {
    content: "";
    position: absolute;
    top: 15px;
    left: 30px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #fff;
    opacity: 0.45;
}

.register::before {
    left: 20px;
    width: 15px;
    height: 15px;
}

.btns {
    transition: 0.25s;
}

.btns:hover {
    border-radius: 50%;
}

为按钮添加悬停效果和装饰性伪元素。


http://www.kler.cn/news/329171.html

相关文章:

  • C# 相等性检测方法差异分析(==,Equals,ReferenceEquals)
  • Kafka和RabbitMQ比较
  • LSTM模型实现光伏发电功率的预测
  • 滚雪球学MySQL[2.2讲]:基本数据操作详解:插入、查询、更新与删除
  • Linux 线程同步
  • 影院管理革新:小徐的Spring Boot应用
  • java 选择排序
  • 【易社保-注册安全分析报告】
  • 【中间件】fastDFS的相关知识
  • oracle解决关联查询报invalid number问题
  • 鸿蒙NEXT开发-组件事件监听和状态管理(基于最新api12稳定版)
  • calibre-web默认左上角字体修改
  • 【分布式微服务云原生】有哪些流行的微服务架构以及各自的组件,怎么完成服务治理等。
  • Spring MVC 常用注解
  • 深度学习自编码器 - 分布式表示篇
  • 鸿蒙开发(NEXT/API 12)【状态查询与订阅】手机侧应用开发
  • 《算法岗面试宝典》重磅发布!
  • Java之方法的使用
  • 《OpenCV》—— 指纹验证
  • DAY18||530.二叉搜索树的最小绝对值差 |501.二叉搜索树中的众数| 236.二叉树的最近公共祖先
  • 车辆重识别(2021ICML改进的去噪扩散概率模型)论文阅读2024/9/29
  • CS 工作笔记:SmartEdit 里创建的是 CMS Component
  • 【Spring】深入理解控制反转-IOC
  • Linux网络操作命令与函数全面总结
  • 机器视觉工程师一直做调试,维护岗位,想转岗软件方面C#从零开始,快则三年不到,慢则一辈子不会
  • YOLO11改进 | 检测头 | 小目标遮挡物性能提升的检测头Detect_MultiSEAM【完整代码】
  • 好玩的水表电表
  • we3.0里的钱包是什么?
  • Linux——pod的控制器
  • AR 眼镜之-蓝牙电话-来电铃声与系统音效