用CSS画一只哆啦A梦

核心方法是使用 box-shandow 阴影来进行一些操作。我们可以阴影的控制,当然,我们可以设置多个阴影,且在渐变项为 0 的时候,其实就是绘制出了单纯的色块。

效果如下:
这里写图片描述

<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <title>test</title>
  <style type="text/css">
  /* 这里就是头部的绘制 */
  div {
    position: relative;
    width: 36px;
    height: 36px;
    margin: 300px auto;
    border-radius: 50%;
    background: #c63d01;
    box-shadow: 0 0 0 1px #000,
    -20px -26px 0 -10px #333,
    -34px -40px 0 15px #fff,
    -34px -40px 0 16px,
    20px -26px 0 -10px #333,
    34px -40px 0 15px #fff,
    34px -40px 0 16px,
    0 55px 0 75px #fff,
    0 55px 0 76px #000,
    0 22px 0 120px #08bdeb, 
    0 22px 0 121px #000;
  }
  /* 这里就是鼻子的绘制 */
  div::before {
    content: '';
    position: absolute;
    bottom: -81px;
    left: 17px;
    height: 80px;
    width: 2px;
    background: #000;
  }
  /* 这里就是嘴巴的绘制 */
  div::after {
    content: '';
    position: absolute;
    bottom: -83px;
    left: -42px;
    height: 70px;
    width: 120px;
    border-bottom: solid 2px #000;
    border-bottom-right-radius: 60px;
    border-bottom-left-radius: 60px;
  }
  </style>
</head>

<body>
  <div></div>
</body>

</html>
  • 1
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值