CSS画皮卡丘

效果图
效果图

index.html

<!doctype html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no,viewport-fit=cover">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>皮卡丘</title>
    <link rel="stylesheet" href="style.css">
</head>
<body>
<div class="skin">
    <div class="eye left"></div>
    <div class="eye right"></div>
    <div class="nose">
        <div class="yuan">
        </div>
    </div>
    <div class="face left"></div>
    <div class="face right"></div>
    <div class="mouth">
        <div class="up">
            <div class="lip left"></div>
            <div class="lip right"></div>
        </div>
        <div class="down">
            <div class="yuan1">
                <div class="yuan2">

                </div>
            </div>
        </div>
    </div>
    <div class="hide"></div>
</div>
<script src="main.js"></script>
</body>
</html>

style.css

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

*::before, *::after {
    box-sizing: border-box
}

body {
    background: #ffe600;
    min-height: 100vh;
}

.nose {
    border: 10px solid black;
    border-color: black transparent transparent transparent;
    width: 0;
    height: 0;
    position: relative;
    left: 50%;
    top: 145px;
    margin-left: -10px;
}

@keyframes wave{
    0%{
        transform: rotate(0deg);
    }
    33%{
        transform: rotate(10deg);
    }
    66%{
        transform: rotate(-10deg);
    }
    100%{
        transform: rotate(0deg);
    }
}
.nose:hover{
    /*transform-origin:center bottom;*/
    animation:wave 500ms infinite linear;
}

.yuan {
    position: absolute;
    width: 20px;
    height: 10px;
    top: -20px;
    left: -10px;
    border-radius: 10px 10px 0 0;
    background: black;
}

.eye {
    border: 2px solid #000;
    width: 64px;
    height: 64px;
    position: absolute;
    left: 50%;
    margin-left: -32px;
    top: 100px;
    background: #2e2e2e;
    border-radius: 50%;
}

.eye::before {
    content: '';
    display: block;
    border: 3px solid #000;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    background: #fff;
    position: relative;
    left: 4px;
    top: 2px;
}

.eye.left {
    transform: translateX(-100px);
}

.eye.right {
    transform: translateX(100px);
}

.mouth {
    width: 200px;
    height: 200px;
    position: absolute;
    left: 50%;
    top: 170px;
    margin-left: -100px;
}

.up {
    position: relative;
}

.lip {
    height: 30px;
    width: 100px;
    border: 3px solid black;
    border-top: none;
    left: 50%;
    z-index: 10;
    background: #ffe600;
}

.lip.left {
    border-radius: 0 0 0 50px;
    border-right: none;
    transform: rotate(-20deg);
    position: absolute;
    margin-left: -50%;
}

.lip.right {
    border-radius: 0 0 50px 0;
    border-left: none;
    transform: rotate(20deg);
    position: absolute;
}

.down {
    height: 180px;
    position: absolute;
    width: 100%;
    overflow: hidden;
}

.yuan1 {
    width: 150px;
    height: 1000px;
    position: absolute;
    bottom: 0;
    left: 50%;
    margin-left: -75px;
    border-radius: 75px/300px;
    background: #9b000a;
    overflow: hidden;
    border: 3px solid black;
}

.hide {
    width: 220px;
    height: 10px;
    position: absolute;
    left: 50%;
    margin-left: -110px;
    transform: translateY(148px);
    background: #ffe600;
}

.yuan2 {
    width: 180px;
    height: 300px;
    position: absolute;
    bottom: -160px;
    left: 50%;
    margin-left: -90px;
    background: #ff485f;
    border-radius: 100px;
}

.face.left {
    position: absolute;
    border: 2px solid black;
    width: 100px;
    height: 100px;
    left:50%;
    margin-left: -50px;
    transform: translateX(-170px);
    top:200px;
    border-radius: 50%;
    background: #ff0000;
}
.face.right {
    position: absolute;
    border: 2px solid black;
    width: 100px;
    height: 100px;
    left:50%;
    margin-left: -50px;
    transform: translateX(175px);
    top:200px;
    border-radius: 50%;
    background: #ff0000;
}

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

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值