当前位置:首页 > CSS

css制作卡通兔子

2026-04-01 16:38:41CSS

使用CSS绘制卡通兔子

通过纯CSS和HTML可以绘制简单的卡通兔子形象,主要利用border-radiustransform和伪元素实现。以下是实现步骤和代码示例:

HTML结构

<div class="rabbit">
  <div class="head"></div>
  <div class="ear left-ear"></div>
  <div class="ear right-ear"></div>
  <div class="eye left-eye"></div>
  <div class="eye right-eye"></div>
  <div class="nose"></div>
  <div class="mouth"></div>
</div>

CSS样式

.rabbit {
  position: relative;
  width: 200px;
  height: 200px;
  margin: 50px auto;
}

.head {
  width: 120px;
  height: 100px;
  background: #f5f5f5;
  border-radius: 50%;
  position: absolute;
  top: 50px;
  left: 40px;
}

.ear {
  width: 30px;
  height: 70px;
  background: #f5f5f5;
  border-radius: 50%;
  position: absolute;
}

.left-ear {
  transform: rotate(-30deg);
  top: 10px;
  left: 50px;
}

.right-ear {
  transform: rotate(30deg);
  top: 10px;
  right: 50px;
}

.eye {
  width: 15px;
  height: 15px;
  background: #333;
  border-radius: 50%;
  position: absolute;
  top: 80px;
}

.left-eye {
  left: 70px;
}

.right-eye {
  right: 70px;
}

.nose {
  width: 10px;
  height: 10px;
  background: pink;
  border-radius: 50%;
  position: absolute;
  top: 95px;
  left: 95px;
}

.mouth {
  width: 30px;
  height: 10px;
  border-bottom: 2px solid #333;
  border-radius: 0 0 50% 50%;
  position: absolute;
  top: 105px;
  left: 85px;
}

进阶效果优化

为增加立体感,可通过添加阴影和渐变:

.head {
  box-shadow: inset -5px -5px 10px rgba(0,0,0,0.1);
  background: linear-gradient(to bottom, #f5f5f5, #e0e0e0);
}

.ear::after {
  content: '';
  width: 20px;
  height: 50px;
  background: pink;
  border-radius: 50%;
  position: absolute;
  bottom: 5px;
  left: 5px;
}

动画效果

添加眨眼动画:

@keyframes blink {
  0%, 100% { height: 15px; }
  50% { height: 3px; }
}

.eye {
  animation: blink 3s infinite;
}

响应式调整

通过媒体查询适配不同屏幕:

css制作卡通兔子

@media (max-width: 600px) {
  .rabbit {
    transform: scale(0.7);
  }
}

最终效果会呈现一个带有耳朵、眼睛、鼻子和嘴巴的简约卡通兔子,可通过调整颜色、尺寸和位置参数实现不同风格。

标签: 兔子卡通
分享给朋友:

相关文章

css制作卡通兔子

css制作卡通兔子

CSS 制作卡通兔子 使用纯CSS绘制卡通兔子需要结合div元素、边框、圆角、阴影等属性,通过几何形状拼接实现。以下是完整代码和实现思路: 基础结构 HTML部分仅需一个容器元素,所有兔子的部件通过…

css制作卡通兔子

css制作卡通兔子

使用CSS绘制卡通兔子 通过纯CSS和HTML可以创建简单的卡通兔子形象,主要利用border-radius、transform和伪元素实现。以下是一个分步实现方案: HTML结构 <…

css制作卡通特效

css制作卡通特效

CSS 制作卡通特效的方法 关键属性与技巧 使用 box-shadow 创建多层次阴影增强立体感,配合 border-radius 实现圆润边缘。transform 的 scale() 和 rotat…

css制作卡通特效

css制作卡通特效

使用CSS制作卡通特效 CSS可以通过动画、变形、阴影等属性创建生动的卡通效果。以下是一些常见方法和技巧: 关键属性 transform:用于旋转、缩放、移动元素 animation:创建关键帧动…