【html+css】简单眼睛转动小猪

效果视频展示:

简单眼睛转动小猪(CSS)-2022-6-7 13:49:54

全部代码(放心粘贴):

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<style>
    .head{
        position: relative;
        width: 600px;
        height: 600px;
        left: 50%;
        margin-left: -300px;
    }
    .head>.lear{
        position: absolute;
        width: 0px;
        height: 0px;
        left: -30px;
        border: 100px solid pink;
        border-radius:  20px 80px 0px 90px;

        transform: rotateZ(-25deg);
    }
    .head>.rear{
        position: absolute;
        width: 0px;
        height: 0px;
        left: 430px;
        border: 100px solid rgb(255, 192, 203);
        border-radius:  80px 15px 90px 0px;

        transform: rotateZ(25deg)
    }
    .head>.face{
        position: absolute;
        width: 500px;
        height: 500px;
        top: 100px;
        left: 50px;
        border: 1px solid black;
        border-radius: 50%;
        background: pink;
    }
    .head>.face>.leye{
        position: absolute;
        width: 100px;
        height: 100px;
        top: 100px;
        left: 100px;
        border: 2px solid black;
        border-radius: 50%;
        background: white;
    }
    .head>.face>.leye>div{
        position: relative;
        width: 50px;
        height: 50px;
        top: 30px;
        left: 20px;
        border: 2px solid black;
        border-radius: 50%;
        background: black;
        animation: move 3s 0s infinite; 
    }
    @keyframes move {
        0%{
            transform: translate(0px);
        }
        50%{
            transform: translate(20px);
        }
        100%{
            transform: translate(-10px);
        }
    }
    .head>.face>.reye{
        position: absolute;
        width: 100px;
        height: 100px;
        top: 100px;
        left: 300px;
        border: 2px solid black;
        border-radius: 50%;
        background: white;
    }
    .head>.face>.reye>div{
        position: relative;
        width: 50px;
        height: 50px;
        top: 30px;
        left: 20px;
        border: 2px solid black;
        border-radius: 50%;
        background: black;
        animation: move 3s 0s infinite; 
    }
    .head>.face>.month{
        position: absolute;
        width: 300px;
        height: 200px;
        top: 250px;
        left: 100px;
        border: 2px solid black;
        border-radius: 45%;

        transform: scale(0.9);
    }
    .head>.face>.month>.lnose{
        position: absolute;
        width: 70px;
        height: 70px;
        top: 55px;
        left: 45px;
        border: 2px solid black;
        border-radius: 50%;
        background: rgb(26, 25, 25);
    }
    .head>.face>.month>.rnose{
        position: absolute;
        width: 70px;
        height: 70px;
        top: 55px;
        left: 175px;
        border: 2px solid black;
        border-radius: 50%;
        background: rgb(26, 25, 25);
    }
</style>
<body>
    <div class="head">
        <div class="lear">
            <div></div>
        </div>
        <div class="rear">
            <div></div>
        </div>
        <div class="face">
            <div class="leye">
                <div></div>
            </div>
            <div class="reye">
                <div></div>
            </div>
            <div class="month">
                <div class="lnose"></div>
                <div class="rnose"></div>
            </div>
        </div>
    </div>

</body>
</html>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值