使用CSS3绘制简单的Android机器人

html部分

<body>
    <div class="board">
        <div class="android">
            <div class="head"></div>
            <div class="body"></div>
            <div class="arms"></div>
        </div>
    </div>
</body>

CSS部分

<style>
    body{
        margin: 0;
        padding: 0;
        background-color: #f7f7f7;
    }

    .board{
        width: 600px;
        height: 440px;
        margin: 80px auto;
        background-color: #fff;
    }

    .android{
        width: 340px;
        height: 330px;
        margin: 0 auto;
        position: relative;
        text-align: center;
    }
    /*脑袋*/
    .head{
        position: relative;
        width: 220px;
        height: 110px;
        margin: 30px auto;
        top: 20px;
        border-radius: 100px 100px 0 0;
        background-color: #a4ca39;
        box-shadow: 5px 5px 10px 5px #666;
    }

    /*眼睛*/
    .head::before,.head::after{
        content: '';
        display: block;
        width: 20px;
        height: 20px;
        background-color: #fff;
        border-radius: 10px;
        position: absolute;
        top: 40px;
    }
    /*眼睛*/
    .head::before{
        left: 50px;
    }

    .head::after{
        right: 50px;
    }

    /*身体*/
    .body{
        width: 220px;
        height: 180px;
        background-color: #a4ca39;
        border-radius: 0 0 20px 20px;
        position: relative;
        margin: 0 auto;
        box-shadow: 5px 5px 10px 5px #666;
    }

    /*两边的手臂*/
    .arms::before,.arms::after{
        content: '';
        display: block;
        width: 50px;
        height: 150px;
        border-radius: 25px;
        position: absolute;
        background-color: #a4ca39;
        top: 15px;
    }

    /*左手*/
    .arms::before{
        box-shadow: -5px 5px 10px 0 #666;
        top: 135px;
        left: 8px;
    }
    /*右手*/
    .arms::after{
        right: 8px;
        box-shadow: 5px 5px 10px 0 #666;
    }

    /*腿部*/
    .body::before,.body::after{
        content: '';
        display: block;
        width: 50px;
        height: 80px;
        border-radius: 0 0 25px 25px;
        position: absolute;
        bottom: -80px;
        background-color: #a4ca39;
        box-shadow: 5px 10px 10px 0 #666;
    }

    /*左腿*/
    .body::before{
        left: 20px;
    }

    /*右腿*/
    .body::after{
        right: 20px;
    }
</style>

效果如下:



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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值