HTML+CSS熊猫(附源码)

预览效果

源码

<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8" />
    <title></title>
    <style>
        * {
      
      
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        .face-container {
      
      
            position: relative;
            width: 300px;
            height: 260px;
            background-color: #55ff7f;
            border-radius: 20%;
            margin: 10% auto 5%;
            transition: all 0.6s;
        }

        .face-container:hover {
      
      
            transform: scale(1.2);
        }

        .head {
      
      
            position: relative;
            z-index: 5;
            width: 280px;
            height: 250px;
            border-radius: 300px;
            background-color: #fff;
            transform: rotate(-15deg);
        }

        .ear-left {
      
      
            position: absolute;
            top: 30px;
            left: -25px;
            z-index: 1;
            width: 90px;
            height: 90px;
            border-radius: 50%;
            background-color: #000;
            transform: rotate(45deg);
        }

        .ear-right {
      
      
            position: absolute;
            top: -20px;
            left: 174px;
            z-index: 1;
            width: 90px;
            height: 90px;
            border-radius: 50%;
            background-color: #000;
            transform: rotate(45deg);
        }

        .eye-left {
      
      
            position: absolute;
            top: 95px;
            left: 174px;
            z-index: 1;
            width: 73px;
            height: 75px;
            border-radius: 40% 60% 48% 52% / 50% 61% 39% 50%;
            background-color: #000;
            transform: rotate(-6deg);
        }

        .eye-right {
      
      
            position: absolute;
            top: 110px;
            left: 45px;
            z-index: 1;
            width: 73px;
            height: 75px;
            border-radius: 66% 34% 48% 52% / 60% 54% 46% 40%;
            background-color: #000;
            transform: rotate(20deg);
        }

        .pupil {
      
      
            position: absolute;
            top: 41px;
            left: 18px;
            z-index: 1;
            width: 40px;
            height: 10px;
            border: 4px solid #fff;
            border-radius: 50% 50% 0 0 / 100% 100% 0 0;
            border-bottom: none;
            transform: rotate(-23deg);
        }

        .nose {
      
      
            position: absolute;
            top: 175px;
            left: 135px;
            z-index: 1;
            width: 40px;
            height: 25px;
            border-radius: 50%;
            background-color: #000;
        }

        .mouth {
      
      
            position: absolute;
            top: 205px;
            left: 137px;
            z-index: 1;
            width: 40px;
            height: 20px;
            border: 1px solid black;
            border-radius: 0 0 50% 50%/0 0 100% 100%;
            border-top: none;
        }
    </style>
</head>

<body>
    <div class="face-container"> 
        <div class="ear-left"></div>
        <div class="ear-right"></div>
        <div class="head">
            <div class="eye-left">
                <div class="pupil"></div>
            </div>
            <div class="eye-right">
                <div class="pupil"></div>
            </div>
            <div class="nose"></div>
            <div class="mouth"></div>
        </div>
    </div>
</body>

</html>

前端群

欢迎大家进群交流

猜你喜欢

转载自blog.csdn.net/m0_50864141/article/details/143305386