经验首页 前端设计 程序设计 Java相关 移动开发 数据库/运维 软件/图像 大数据/云计算 其他经验
当前位置:技术经验 » HTML/CSS » CSS3 » 查看文章
用css画一个哆啦A梦
来源:cnblogs  作者:huangminjian  时间:2019/4/17 8:50:41  对本文有异议

原图:

效果图:

虽然说没用啥什么高级的技巧,但这让我感受到了CSS的乐趣!

好好学习,天天向上!

  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4.     <title></title>
  5.     <style type="text/css">
  6.     body{
  7.         background-color: #66B3FF;
  8.         height: 300px;
  9.         overflow: hidden;
  10.     }
  11.         #head{
  12.             width: 200px;
  13.             height: 200px;
  14.             position: absolute;
  15.             left: 50%;
  16.             top:31%;
  17.             margin-left: -100px;
  18.             margin-top: -100px;
  19.             background-color: #0080FF;
  20.             border-radius: 999px;
  21.             border: 1px solid black;
  22.         }
  23.         #face{
  24.             width: 179px;
  25.             height: 150px;
  26.             position: absolute;
  27.             left: 43.4%;
  28.             top:22%;
  29.             
  30.             background-color: white;
  31.             border-radius: 999px;
  32.             border: 1px solid black;
  33.         }
  34.         #leftEye{
  35.             width: 50px;
  36.             height: 60px;
  37.             position: absolute;
  38.             left:46.2%;
  39.             top:18%;
  40.             
  41.             background-color: white;
  42.             border-radius: 50%;
  43.             border: 1px solid black;    
  44.         }
  45.         #rightEye{
  46.             width: 50px;
  47.             height: 60px;
  48.             position: absolute;
  49.             left:50%;
  50.             top:18%;
  51.             
  52.             background-color: white;
  53.             border-radius: 50%;
  54.             border: 1px solid black;    
  55.         }
  56.         #leftEye1{
  57.             width: 13px;
  58.             height: 20px;
  59.             position: absolute;
  60.             left:48.5%;
  61.             top:22.2%;
  62.             
  63.             background-color: black;
  64.             border-radius: 50%;
  65.             border: 1px solid black;    
  66.         }
  67.         #rightEye1{
  68.             width: 13px;
  69.             height: 20px;
  70.             position: absolute;
  71.             left:50.5%;
  72.             top:22.2%;
  73.             background-color: black;
  74.             border-radius: 50%;
  75.             border: 1px solid black;    
  76.         }
  77.         #leftEye2{
  78.             width: 5px;
  79.             height: 8px;
  80.             position: absolute;
  81.             left:48.9%;
  82.             top:23%;
  83.             
  84.             background-color: white;
  85.             border-radius: 50%;
  86.             border: 1px solid black;    
  87.         }
  88.         #rightEye2{
  89.             width: 5px;
  90.             height: 8px;
  91.             position: absolute;
  92.             left:50.7%;
  93.             top:23%;
  94.             
  95.             background-color: white;
  96.             border-radius: 50%;
  97.             border: 1px solid black;    
  98.         }
  99.         #nose{
  100.             width: 25px;
  101.             height: 25px;
  102.             position: absolute;
  103.             left:49%;
  104.             top:25.5%;
  105.             
  106.             background-color: red;
  107.             border-radius: 50%;
  108.             border: 1px solid black;
  109.         }
  110.         #nose1{
  111.             width: 6px;
  112.             height: 6px;
  113.             position: absolute;
  114.             left:49.5%;
  115.             top:26.5%;
  116.             
  117.             background-color: white;
  118.             border-radius: 50%;
  119.                 
  120.         }
  121.         #line{
  122.             width: 1px;
  123.             height: 100px;
  124.             position: absolute;
  125.             left:49.9%;
  126.             top:29.7%;
  127.             background-color: white;
  128.             border-left: 2px solid #000000;
  129.             margin-left: 1px;
  130.         }
  131.         #line1{
  132.             width: 60px;
  133.             height: 1px;
  134.             position: absolute;
  135.             left:43.5%;
  136.             top:28%;
  137.             background-color: white;
  138.             border-bottom: 1px solid #000000;
  139.             margin-left: 1px;
  140.             transform:rotate(12deg);
  141.         }
  142.             #line2{
  143.             width: 60px;
  144.             height: 1px;
  145.             position: absolute;
  146.             left:43.5%;
  147.             top:32%;
  148.             background-color: white;
  149.             border-bottom: 1px solid #000000;
  150.             margin-left: 1px;
  151.             
  152.         }
  153.             #line3{
  154.             width: 60px;
  155.             height: 1px;
  156.             position: absolute;
  157.             left:43.5%;
  158.             top:36%;
  159.             background-color: white;
  160.             border-bottom: 1px solid #000000;
  161.             margin-left: 1px;
  162.             transform:rotate(-12deg);
  163.         }
  164.         #line4{
  165.             width: 60px;
  166.             height: 1px;
  167.             position: absolute;
  168.             left:51.6%;
  169.             top:28%;
  170.             background-color: white;
  171.             border-bottom: 1px solid #000000;
  172.             margin-left: 1px;
  173.             transform:rotate(-12deg);
  174.         }
  175.         #line5{
  176.             width: 60px;
  177.             height: 1px;
  178.             position: absolute;
  179.             left:51.6%;
  180.             top:32%;
  181.             background-color: white;
  182.             border-bottom: 1px solid #000000;
  183.             margin-left: 1px;
  184.             
  185.         }
  186.         #line6{
  187.             width: 60px;
  188.             height: 1px;
  189.             position: absolute;
  190.             left:51.6%;
  191.             top:36%;
  192.             background-color: white;
  193.             border-bottom: 1px solid #000000;
  194.             margin-left: 1px;
  195.             transform:rotate(12deg);
  196.         }
  197.     
  198.         #mouse{
  199.             width: 130px;
  200.             height: 130px;
  201.             position: absolute;
  202.             left: 45.1%;
  203.             top:30%;
  204.             margin-left: -0.5px;
  205.             background-color: white;
  206.             border-radius: 0 0 65px 65px;
  207.             border-bottom: 2px solid black;
  208.             height: 65px;
  209.         }
  210.         #food{
  211.             width: 80px;
  212.             height: 62px;
  213.             position: absolute;
  214.             left:46.9%;
  215.             top:39.2%;
  216.             
  217.             background-color:#FFAF60;
  218.             border-radius: 50%;
  219.             border: 1px solid black;
  220.         }
  221.         #food1{
  222.             width: 78px;
  223.             height: 57px;
  224.             position: absolute;
  225.             left:47%;
  226.             top:38.9%;
  227.             
  228.             background-color: #FFAF60;
  229.             border-radius: 50%;
  230.             border: 1px solid black;
  231.         }
  232.         #food2{
  233.             width: 73px;
  234.             height: 52px;
  235.             position: absolute;
  236.             left:47.2%;
  237.             top:39.1%;
  238.             
  239.             background-color:#844200;
  240.             border-radius: 50%;
  241.             
  242.         }
  243.         #leftFist{
  244.             width: 50px;
  245.             height: 50px;
  246.             position: absolute;
  247.             left:45%;
  248.             top:40%;
  249.             margin-left: -15px;
  250.             margin-top: -15px;
  251.             background-color: white;
  252.             border-radius: 999px;
  253.             border: 1px solid black;
  254.         }
  255.         #rightFist{
  256.             width: 50px;
  257.             height: 50px;
  258.             position: absolute;
  259.             left:53%;
  260.             top:40%;
  261.             margin-left: -15px;
  262.             margin-top: -15px;
  263.             background-color: white;
  264.             border-radius: 999px;
  265.             border: 1px solid black;
  266.         }
  267.         #leftHand{
  268.             width: 50px;
  269.             height: 70px;
  270.             position: absolute;
  271.             left:43.3%;
  272.             top:44%;
  273.             margin-left: -15px;
  274.             margin-top: -15px;
  275.             background-color: #0080FF;
  276.             border-radius: 50%;
  277.             transform:rotate(34deg);
  278.             border: 1px solid black;
  279.         }
  280.         #rightHand{
  281.             width: 50px;
  282.             height: 70px;
  283.             position: absolute;
  284.             left:54.3%;
  285.             top:44%;
  286.             margin-left: -15px;
  287.             margin-top: -15px;
  288.             background-color: #0080FF;
  289.             border-radius: 50%;
  290.             transform:rotate(-34deg);
  291.             border: 1px solid black;
  292.         }
  293.         #tummy{
  294.             width: 110px;
  295.             height: 110px;
  296.             position: absolute;
  297.             left: 53.1%;
  298.             top:58.5%;
  299.             margin-left: -100px;
  300.             margin-top: -100px;
  301.             background-color: white;
  302.             border-radius: 999px;
  303.             border: 1px solid black;
  304.         }
  305.         #bodyy{
  306.             width: 135px;
  307.             height: 115px;
  308.             position: absolute;
  309.             left: 44.7%;
  310.             top:45%;
  311.             background-color: #0080FF;
  312.         }
  313.         #cover{
  314.             width: 400px;
  315.             height: 400px;
  316.             position: absolute;
  317.             left: 35.3%;
  318.             top:62.3%;
  319.             background-color:#66B3FF;
  320.             border-radius: 50%;
  321.         }
  322.         #leftLeg{
  323.             width: 80px;
  324.             height: 90px;
  325.             position: absolute;
  326.             left:42%;
  327.             top:53.5%;
  328.             margin-left: -15px;
  329.             margin-top: -15px;
  330.             background-color: white;
  331.             border-radius: 50%;
  332.             border: 1px solid black;
  333.         }
  334.         #rightLeg{
  335.             width: 80px;
  336.             height: 90px;
  337.             position: absolute;
  338.             left:53.7%;
  339.             top:53.5%;
  340.             margin-left: -15px;
  341.             margin-top: -15px;
  342.             background-color: white;
  343.             border-radius: 50%;
  344.             border: 1px solid black;
  345.         }
  346.         #pocket{
  347.             width: 88px;
  348.             height: 82px;
  349.             position: absolute;
  350.             left: 46.5%;
  351.             top:51.6%;
  352.             margin-left: -0.5px;
  353.             background-color: white;
  354.             border-radius: 0 0 41px 41px;
  355.             border: 1px solid black;
  356.             height: 41px;
  357.  
  358.         }
  359.     </style>
  360. </head>
  361. <body>
  362.         <div id="head"></div>
  363.         <div id="face"></div>
  364.         <div id="leftEye"></div>
  365.         <div id="rightEye"></div>
  366.         <div id="leftEye1"></div>
  367.         <div id="rightEye1"></div>
  368.         <div id="leftEye2"></div>
  369.         <div id="rightEye2"></div>
  370.         <div id="nose"></div>
  371.         <div id="nose1"></div>
  372.         <div id="bodyy"></div>
  373.         <div id="tummy"></div>
  374.         <div id="mouse"></div>
  375.         <div id="line"></div>
  376.         <div id="line1"></div>
  377.         <div id="line2"></div>
  378.         <div id="line3"></div>
  379.         <div id="line4"></div>
  380.         <div id="line5"></div>
  381.         <div id="line6"></div>
  382.         <div id="food"></div>
  383.         <div id="food1"></div>
  384.         <div id="food2"></div>
  385.         
  386.         <div id="leftHand"></div>    
  387.         <div id="rightHand"></div>    
  388.         
  389.         
  390.         <div id="cover"></div>
  391.         <div id="leftFist"></div>    
  392.         <div id="rightFist"></div>
  393.         <div id="leftLeg"></div>    
  394.         <div id="rightLeg"></div>    
  395.         <div id="pocket"></div>    
  396. </body>
  397. </html>

原文链接:http://www.cnblogs.com/huangminjian/p/10720800.html

 友情链接:直通硅谷  点职佳  北美留学生论坛

本站QQ群:前端 618073944 | Java 606181507 | Python 626812652 | C/C++ 612253063 | 微信 634508462 | 苹果 692586424 | C#/.net 182808419 | PHP 305140648 | 运维 608723728

W3xue 的所有内容仅供测试,对任何法律问题及风险不承担任何责任。通过使用本站内容随之而来的风险与本站无关。
关于我们  |  意见建议  |  捐助我们  |  报错有奖  |  广告合作、友情链接(目前9元/月)请联系QQ:27243702 沸活量
皖ICP备17017327号-2 皖公网安备34020702000426号