CSS页面效果_浮动幽灵

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

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        body {
            margin: 0;
            padding: 0;
            background-color: #2c3a47;
            height: 100vh;
            display: flex;
            align-items: center;
            justify-content: center;
        }

        .ghost {
            width: 140px;
            height: 160px;
            background-color: #f2f2f2;
            border-radius: 70px 70px 0 0;
            position: relative;
            cursor: pointer;
            animation: floating 2s infinite ease-in-out;
        }

        @keyframes floating {
            50% {
                transform: translateY(-60px);
            }
        }

        .face {
            width: 100px;
            position: absolute;
            top: 60px;
            left: calc(50% - 50px);
        }

        .eyes {
            height: 24px;
            display: flex;
            justify-content: space-around;
            align-items: center;
            margin-bottom: 14px;
        }

        .eyes span {
            width: 24px;
            height: 24px;
            background-color: #2c3a47;
            border-radius: 50%;
            transition: .3s linear;
        }
        .meimao {
            height: 2px;
            display: flex;
            justify-content: space-around;
            align-items: center;
            margin-bottom: 14px;
        }

        .meimao span{
            height: 8px;
            width: 20px;
            background-color: chocolate;
            border-radius: 50px 50px 0 0;
        }
        .ghost:hover .meimao span{
            height: 4px;
        }

        .ghost:hover .eyes span {
            height: 16px;
        }

        .mouth {
            width: 40px;
            height: 20px;
            background-color: #2c3a47;
            margin: auto;
            border-radius: 0 0 20px 20px;
            transition: .3s linear;
        }

        .ghost:hover .mouth {
            height: 12px;
        }

        .hands {
            width: 180px;
            position: absolute;
            left: -20px;
            top: 80px;
            display: flex;
            justify-content: space-between;
        }

        .hands span {
            width: 20px;
            height: 30px;
            background-color: #f2f2f2;
        }

        .hands span:first-child {
            border-radius: 20px 0 0 0;
        }

        .hands span:last-child {
            border-radius: 0 20px 0 0;
        }

        .feet {
            position: absolute;
            width: 100%;
            bottom: -20px;
            display: flex;
        }

        .feet span {
            flex: 1;
            height: 20px;
            background-color: #f2f2f2;
            border-radius: 0 0 20px 20px;
        }

        .feet span:first-child {
            border-radius: 0 0 20px 12px;
        }

        .feet span:last-child {
            border-radius: 0 0 10px 20px;
        }
    </style>
</head>

<body>
    <div class="ghost">
        <div class="face">
            <div class="meimao">
                <span></span><span></span>
            </div>
            <div class="eyes">
                <span></span><span></span>
            </div>
            <div class="mouth"></div>
        </div>
        <div class="hands">
            <span></span><span></span>
        </div>

        <div class="feet">
            <span></span>
            <span></span>
            <span></span>
            <span></span>
        </div>
    </div>
</body>

</html>

GIF效果如下:
在这里插入图片描述

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值