微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

html动态小黄人代码

大家好,今天我来给大家介绍一款非常有趣的HTML动态小黄人代码

    <div class="minions">
        <img src="minion.png" alt="Minion">
        <div class="eyes"></div>
        <div class="mouth"></div>
    </div>

    <style>
        .minions {
            position: relative;
            width: 200px;
            height: 200px;
        }
        .eyes {
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%,-50%);
            width: 70px;
            height: 30px;
            border-radius: 50%;
            background-color: #000;
            animation: eyes-move 2s infinite;
        }
        .mouth {
            position: absolute;
            top: 72%;
            left: 50%;
            transform: translate(-50%,-50%);
            width: 35px;
            height: 35px;
            border-radius: 50%;
            background-color: #000;
            animation: mouth-move 2s infinite;
        }
        .eyes:before {
            position: absolute;
            content: "";
            top: 50%;
            left: 50%;
            transform: translate(-50%,-50%);
            width: 20px;
            height: 20px;
            border-radius: 50%;
            background-color: #FFF;
            animation: eyes-before-move 2s infinite;
        }
        .eyes:after {
            position: absolute;
            content: "";
            top: 50%;
            left: 50%;
            transform: translate(-50%,-50%);
            width: 10px;
            height: 10px;
            border-radius: 50%;
            background-color: #000;
        }
        @keyframes eyes-move {
            50% {
                transform: translateY(20%);
            }
        }
        @keyframes mouth-move {
            50% {
                 transform: translateY(-20%);
            }
        }
        @keyframes eyes-before-move {
            50% {
                transform: translateX(-30%);
            }
        }
    </style>

html动态小黄人代码

这是一个非常有趣的小黄人代码,只需要复制粘贴就可以实现一个动态的小黄人。通过调整样式中的各个属性,您可以轻松修改小黄人的动画效果和样式。

希望大家喜欢这个代码,玩得开心!

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐