css3绘制机器人

想不想用纯代码来绘制图形,而且不使用h5的cavans,zz只用css3,下面我来示范下:

<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title></title>
    <style   type="text/css">
        body {
            margin: 0;
            padding: 0;
            background-color: #F7F7F7;
        }
        .board {
            width: 600px;
            height: 440px;
            margin: 80px auto;
            background-color:gainsboro;
        }
        .android {
            width: 340px;
            padding-top: 40px;
            margin: 0 auto;
            position: relative;
        }
        /*脑袋*/
        .head{
            width: 220px;
            height: 100px;
            background-color:red;
            margin: 0 auto 10px;
            position: relative;
            border-radius: 100px 100px 0 0;
        }
        .head::before,
        .head::after{
            content: '';
            width: 20px;
            height: 20px;
            display: block;

            border-radius: 10px;
            position: absolute;
            top: 40px;

        }
        /*左眼*/
        .head::before {
            left: 50px;
            background-color:black;
        }
         /*右眼*/
        .head::after {
            right: 50px;
            background-color:black;
        }

        .body{
            width: 230px;
            height: 180px;
            margin: 0 auto;
            background-color:pink;
            border-radius: 0 0 25px 25px;
            position: relative;
        }
            /*腿*/
        .body:before,.body:after{
            content: '';
            width: 50px;
            height: 80px;
            display: block;
            background-color: #FFF;
            border-radius: 10px;
            position: absolute;
           bottom: -80px;

        }
        /*胳膊*/
        .arms{
            width: 340px;
            height: 150px;
            position: absolute;
            top: 150px;
        }
        .arms::before,
        .arms::after {
            content: '';
            display: block;
            width: 50px;
            height: 150px;

            border-radius: 25px;
            position: absolute;
        }
        .arms::before{
            left: 0;
            background-color: black;
        }
        .arms::after{
            right: 0;
            background-color:black;
        }
        .body::before {
            left: 40px;
            background-color:orangered;
        }

        .body::after {
            right: 40px;
            background-color:orangered;
        }
        p{
            font-size: 30px;
            font-weight: bold;
            text-align: center;
            text-shadow: -3px -3px 1px #fff,3px 3px 1px #000 ;
        }
    </style>
</head>
<body>
   <div   class="board">
       <div class="android">
           <div  class="head"></div>
           <div  class="body"><p>机器人</p></div>
           <div class="arms"></div>

       </div>
   </div>
</body>
</html>
效果图:






评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值