鱼C论坛

 找回密码
 立即注册
查看: 2049|回复: 5

[已解决]Web画一个大白

[复制链接]
发表于 2023-3-20 13:32:28 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能^_^

您需要 登录 才可以下载或查看,没有账号?立即注册

x
为什么大白的右手大小两个指头没缝隙,按照小甲鱼老师的代码敲,没找到不一样的
代码如下:    最后面有图片
<!DOCTYPE html>
<html>
<head>
        <title>手绘大白</title>
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <meta name="keywords" content="小甲鱼,Web开发,HTML5,CSS3,Web编程教学">
        <meta name="description" content="《零基础入门学习Web开发》案例演示">
        <meta name="author" content="巅峰老甲鱼1">
        <link rel="stylesheet" href="styles.css" type="text/css">
        
</head>
<body>
        <div id="baymax">
                <!--定义头部,包括两个眼睛、嘴-->
                <div id="head">
                        <div id="eye"></div>
                        <div id="eye2"></div>
                        <div id="mouth"></div>
                </div>
               
                <!--定义躯干,包括心脏-->
                <div id="torso">
                        <div id="heart"></div>
                </div>
               
                <!--定义肚子腹部,包括 cover (和躯干的连接处)-->
                <div id="belly">
                        <div id="cover"></div>
                </div>
               
                <!--定义左臂,包括一大一小两个手指-->
                <div id="left-arm">
                        <div id="l-bigfinger"></div>
                        <div id="l-smallfinger"></div>
                </div>
               
                <!--定义右臂,同样包括一大一小两个手指-->
                <div id="right-arm">
                        <div id="r-bigfinger"></div>
                        <div id="r-smallfinger"></div>
                </div>
               
                <!--定义左腿-->
                <div id="left-leg"></div>
               
                <!--定义右腿-->
                <div id="right-leg"></div>
        </div>
</body>
</html>






CSS:


body {
        background: #000;
}
#baymax {
        /* 设置为居中 */
        margin: 0 auto;
        
        /* 高度 */
        height:600px;
        
        /* 隐藏溢出 */
        overflow: hidden;
}
#head {
        height: 64px;
        width: 100px;
        
        /* 以百分比定义圆角的形状 */
        border-radius: 50%;
        
        /*背景*/
        background: #fff;
        margin: 0 auto;
        margin-bottom: -20px;
        
        /*设置下边框的样式*/
        border-bottom: 5px solid #e0e0e0;
        
        /*设置元素的堆叠顺序,
          拥有更高堆叠顺序的元素总是会处于堆叠顺序较低的元素的前面
        */
        z-index: 100;
        
        /*生成相对定位的元素*/
        position: relative;
}

#eye,
#eye2 {
        width: 11px;
        height: 13px;
        background: #282828;
        border-radius: 50%;
        position: relative;
        top: 30px;
        left: 27px;
        
        /*旋转该元素*/
        transform: rotate(8deg);
}

#eye2 {
        /*使其旋转对称*/
        transform: rotate(-8deg);
        left: 69px;
        top: 17px;
}

#mouth {
        width: 38px;
        height: 1.5px;
        background: #282828;
        position: relative;
        left: 34px;
        top: 10px;
}

/*躯干和腹部*/
#torso,
#belly {
        margin: 0 auto;
        height: 200px;
        width: 180px;
        background: #fff;
        border-radius: 47%;
        
        /*设置边框*/
        border: 5px solid #e0e0e0;
        border-top: none;
        z-index: 1;
}

#belly {
        height: 300px;
        width: 245px;
        margin-top: -140px;
        z-index: 5;
}

#cover {
        width: 190px;
        background: #fff;
        height: 150px;
        margin: 0 auto;
        position: relative;
        top: -20px;
        border-radius: 50%;
}

/*心脏*/
#heart {
        width: 25px;
        height: 25px;
        border-radius: 50%;
        position: relative;
        
        /*向边框四周添加阴影效果*/
        box-shadow: 2px 5px 2px #ccc inset;
        
        right: -115px;
        top: 40px;
        z-index: 111;
        border: 1px solid #ccc;
}

/*手臂*/
#left-arm,
#right-arm {
        height: 270px;
        width: 120px;
        border-radius: 50%;
        background: #fff;
        margin: 0 auto;
        position: relative;
        top: -350px;
        left: -100px;
        transform: rotate(20deg);
        z-index: -1;
}

#right-arm {
        transform: rotate(-20deg);
        left: 100px;
        top: -620px;
}

/*手指头*/
#l-bigfinger,
#r-bigfinger {
        height: 50px;
        width: 20px;
        border-radius: 50%;
        background: #fff;
        position: relative;
        top: 250px;
        left: 50px;
        transform: rotate(-50deg);
}

#r-bigfinger {
        left: 50px;
        transform: rotate(50deg);
}

#l-smallfinger,
#r-smallfinger {
        height: 35px;
        width: 15px;
        border-radius: 50%;
        background: #fff;
        position: relative;
        top: 195px;
        left: 66px;
        transform: rotate(-40deg);
}

#r-smallfinger {
        background: #fff;
        transform: rotate(40deg);
        top: 195px;
        left: 37px;
}

/*大腿*/
#left-leg,
#right-leg {
        height: 170px;
        width: 90px;
        border-radius: 40% 30% 10px 45%;
        background: #fff;
        position: relative;
        top: -640px;
        left: -45px;
        transform: rotate(-1deg);
        z-index: -2;
        margin: 0 auto;
}

#right-leg {
        background: #fff;
        border-radius: 30% 40% 45% 10px;
        margin: 0 auto;
        top: -810px;
        left: 50px;
        transform: rotate(1deg);
}






最佳答案
2023-3-20 13:53:06
问题出在第 164 行,你用了中文分号

  1. body {
  2.         background: #000;
  3. }
  4. #baymax {
  5.         /* 设置为居中 */
  6.         margin: 0 auto;
  7.         
  8.         /* 高度 */
  9.         height:600px;
  10.         
  11.         /* 隐藏溢出 */
  12.         overflow: hidden;
  13. }
  14. #head {
  15.         height: 64px;
  16.         width: 100px;
  17.         
  18.         /* 以百分比定义圆角的形状 */
  19.         border-radius: 50%;
  20.         
  21.         /*背景*/
  22.         background: #fff;
  23.         margin: 0 auto;
  24.         margin-bottom: -20px;
  25.         
  26.         /*设置下边框的样式*/
  27.         border-bottom: 5px solid #e0e0e0;
  28.         
  29.         /*设置元素的堆叠顺序,
  30.           拥有更高堆叠顺序的元素总是会处于堆叠顺序较低的元素的前面
  31.         */
  32.         z-index: 100;
  33.         
  34.         /*生成相对定位的元素*/
  35.         position: relative;
  36. }

  37. #eye,
  38. #eye2 {
  39.         width: 11px;
  40.         height: 13px;
  41.         background: #282828;
  42.         border-radius: 50%;
  43.         position: relative;
  44.         top: 30px;
  45.         left: 27px;
  46.         
  47.         /*旋转该元素*/
  48.         transform: rotate(8deg);
  49. }

  50. #eye2 {
  51.         /*使其旋转对称*/
  52.         transform: rotate(-8deg);
  53.         left: 69px;
  54.         top: 17px;
  55. }

  56. #mouth {
  57.         width: 38px;
  58.         height: 1.5px;
  59.         background: #282828;
  60.         position: relative;
  61.         left: 34px;
  62.         top: 10px;
  63. }

  64. /*躯干和腹部*/
  65. #torso,
  66. #belly {
  67.         margin: 0 auto;
  68.         height: 200px;
  69.         width: 180px;
  70.         background: #fff;
  71.         border-radius: 47%;
  72.         
  73.         /*设置边框*/
  74.         border: 5px solid #e0e0e0;
  75.         border-top: none;
  76.         z-index: 1;
  77. }

  78. #belly {
  79.         height: 300px;
  80.         width: 245px;
  81.         margin-top: -140px;
  82.         z-index: 5;
  83. }

  84. #cover {
  85.         width: 190px;
  86.         background: #fff;
  87.         height: 150px;
  88.         margin: 0 auto;
  89.         position: relative;
  90.         top: -20px;
  91.         border-radius: 50%;
  92. }

  93. /*心脏*/
  94. #heart {
  95.         width: 25px;
  96.         height: 25px;
  97.         border-radius: 50%;
  98.         position: relative;
  99.         
  100.         /*向边框四周添加阴影效果*/
  101.         box-shadow: 2px 5px 2px #ccc inset;
  102.         
  103.         right: -115px;
  104.         top: 40px;
  105.         z-index: 111;
  106.         border: 1px solid #ccc;
  107. }

  108. /*手臂*/
  109. #left-arm,
  110. #right-arm {
  111.         height: 270px;
  112.         width: 120px;
  113.         border-radius: 50%;
  114.         background: #fff;
  115.         margin: 0 auto;
  116.         position: relative;
  117.         top: -350px;
  118.         left: -100px;
  119.         transform: rotate(20deg);
  120.         z-index: -1;
  121. }

  122. #right-arm {
  123.         transform: rotate(-20deg);
  124.         left: 100px;
  125.         top: -620px;
  126. }

  127. /*手指头*/
  128. #l-bigfinger,
  129. #r-bigfinger {
  130.         height: 50px;
  131.         width: 20px;
  132.         border-radius: 50%;
  133.         background: #fff;
  134.         position: relative;
  135.         top: 250px;
  136.         left: 50px;
  137.         transform: rotate(-50deg);
  138. }

  139. #r-bigfinger {
  140.         left: 50px;
  141.         transform: rotate(50deg);
  142. }

  143. #l-smallfinger,
  144. #r-smallfinger {
  145.         height: 35px;
  146.         width: 15px;
  147.         border-radius: 50%;
  148.         background: #fff;
  149.         position: relative;
  150.         top: 195px;
  151.         left: 66px;
  152.         transform: rotate(-40deg);                                                                       /* 这里的分号你用了中文分号 */
  153. }

  154. #r-smallfinger {
  155.         background: #fff;
  156.         transform: rotate(40deg);
  157.         top: 195px;
  158.         left: 37px;
  159. }

  160. /*大腿*/
  161. #left-leg,
  162. #right-leg {
  163.         height: 170px;
  164.         width: 90px;
  165.         border-radius: 40% 30% 10px 45%;
  166.         background: #fff;
  167.         position: relative;
  168.         top: -640px;
  169.         left: -45px;
  170.         transform: rotate(-1deg);
  171.         z-index: -2;
  172.         margin: 0 auto;
  173. }

  174. #right-leg {
  175.         background: #fff;
  176.         border-radius: 30% 40% 45% 10px;
  177.         margin: 0 auto;
  178.         top: -810px;
  179.         left: 50px;
  180.         transform: rotate(1deg);
  181. }
复制代码
微信图片_20230320133043.jpg
小甲鱼最新课程 -> https://ilovefishc.com
回复

使用道具 举报

发表于 2023-3-20 13:53:06 | 显示全部楼层    本楼为最佳答案   
问题出在第 164 行,你用了中文分号

  1. body {
  2.         background: #000;
  3. }
  4. #baymax {
  5.         /* 设置为居中 */
  6.         margin: 0 auto;
  7.         
  8.         /* 高度 */
  9.         height:600px;
  10.         
  11.         /* 隐藏溢出 */
  12.         overflow: hidden;
  13. }
  14. #head {
  15.         height: 64px;
  16.         width: 100px;
  17.         
  18.         /* 以百分比定义圆角的形状 */
  19.         border-radius: 50%;
  20.         
  21.         /*背景*/
  22.         background: #fff;
  23.         margin: 0 auto;
  24.         margin-bottom: -20px;
  25.         
  26.         /*设置下边框的样式*/
  27.         border-bottom: 5px solid #e0e0e0;
  28.         
  29.         /*设置元素的堆叠顺序,
  30.           拥有更高堆叠顺序的元素总是会处于堆叠顺序较低的元素的前面
  31.         */
  32.         z-index: 100;
  33.         
  34.         /*生成相对定位的元素*/
  35.         position: relative;
  36. }

  37. #eye,
  38. #eye2 {
  39.         width: 11px;
  40.         height: 13px;
  41.         background: #282828;
  42.         border-radius: 50%;
  43.         position: relative;
  44.         top: 30px;
  45.         left: 27px;
  46.         
  47.         /*旋转该元素*/
  48.         transform: rotate(8deg);
  49. }

  50. #eye2 {
  51.         /*使其旋转对称*/
  52.         transform: rotate(-8deg);
  53.         left: 69px;
  54.         top: 17px;
  55. }

  56. #mouth {
  57.         width: 38px;
  58.         height: 1.5px;
  59.         background: #282828;
  60.         position: relative;
  61.         left: 34px;
  62.         top: 10px;
  63. }

  64. /*躯干和腹部*/
  65. #torso,
  66. #belly {
  67.         margin: 0 auto;
  68.         height: 200px;
  69.         width: 180px;
  70.         background: #fff;
  71.         border-radius: 47%;
  72.         
  73.         /*设置边框*/
  74.         border: 5px solid #e0e0e0;
  75.         border-top: none;
  76.         z-index: 1;
  77. }

  78. #belly {
  79.         height: 300px;
  80.         width: 245px;
  81.         margin-top: -140px;
  82.         z-index: 5;
  83. }

  84. #cover {
  85.         width: 190px;
  86.         background: #fff;
  87.         height: 150px;
  88.         margin: 0 auto;
  89.         position: relative;
  90.         top: -20px;
  91.         border-radius: 50%;
  92. }

  93. /*心脏*/
  94. #heart {
  95.         width: 25px;
  96.         height: 25px;
  97.         border-radius: 50%;
  98.         position: relative;
  99.         
  100.         /*向边框四周添加阴影效果*/
  101.         box-shadow: 2px 5px 2px #ccc inset;
  102.         
  103.         right: -115px;
  104.         top: 40px;
  105.         z-index: 111;
  106.         border: 1px solid #ccc;
  107. }

  108. /*手臂*/
  109. #left-arm,
  110. #right-arm {
  111.         height: 270px;
  112.         width: 120px;
  113.         border-radius: 50%;
  114.         background: #fff;
  115.         margin: 0 auto;
  116.         position: relative;
  117.         top: -350px;
  118.         left: -100px;
  119.         transform: rotate(20deg);
  120.         z-index: -1;
  121. }

  122. #right-arm {
  123.         transform: rotate(-20deg);
  124.         left: 100px;
  125.         top: -620px;
  126. }

  127. /*手指头*/
  128. #l-bigfinger,
  129. #r-bigfinger {
  130.         height: 50px;
  131.         width: 20px;
  132.         border-radius: 50%;
  133.         background: #fff;
  134.         position: relative;
  135.         top: 250px;
  136.         left: 50px;
  137.         transform: rotate(-50deg);
  138. }

  139. #r-bigfinger {
  140.         left: 50px;
  141.         transform: rotate(50deg);
  142. }

  143. #l-smallfinger,
  144. #r-smallfinger {
  145.         height: 35px;
  146.         width: 15px;
  147.         border-radius: 50%;
  148.         background: #fff;
  149.         position: relative;
  150.         top: 195px;
  151.         left: 66px;
  152.         transform: rotate(-40deg);                                                                       /* 这里的分号你用了中文分号 */
  153. }

  154. #r-smallfinger {
  155.         background: #fff;
  156.         transform: rotate(40deg);
  157.         top: 195px;
  158.         left: 37px;
  159. }

  160. /*大腿*/
  161. #left-leg,
  162. #right-leg {
  163.         height: 170px;
  164.         width: 90px;
  165.         border-radius: 40% 30% 10px 45%;
  166.         background: #fff;
  167.         position: relative;
  168.         top: -640px;
  169.         left: -45px;
  170.         transform: rotate(-1deg);
  171.         z-index: -2;
  172.         margin: 0 auto;
  173. }

  174. #right-leg {
  175.         background: #fff;
  176.         border-radius: 30% 40% 45% 10px;
  177.         margin: 0 auto;
  178.         top: -810px;
  179.         left: 50px;
  180.         transform: rotate(1deg);
  181. }
复制代码
小甲鱼最新课程 -> https://ilovefishc.com
回复 支持 反对

使用道具 举报

发表于 2023-3-20 14:02:43 From FishC Mobile | 显示全部楼层
isdkz 发表于 2023-3-20 13:53
问题出在第 164 行,你用了中文分号

厉害
小甲鱼最新课程 -> https://ilovefishc.com
回复 支持 1 反对 0

使用道具 举报

 楼主| 发表于 2023-3-20 14:23:06 From FishC Mobile | 显示全部楼层
确实厉害,学习无止境啊
小甲鱼最新课程 -> https://ilovefishc.com
回复 支持 反对

使用道具 举报

发表于 2023-3-20 16:05:21 | 显示全部楼层
小甲鱼最新课程 -> https://ilovefishc.com
回复

使用道具 举报

发表于 2023-3-20 21:12:30 | 显示全部楼层
isdkz 发表于 2023-3-20 13:53
问题出在第 164 行,你用了中文分号

高手
小甲鱼最新课程 -> https://ilovefishc.com
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Archiver|鱼C工作室 ( 粤ICP备18085999号-1 | 粤公网安备 44051102000585号)

GMT+8, 2025-6-10 05:20

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表