…">
当前位置:首页 > CSS

css制作小黄人

2026-01-28 13:33:23CSS

使用CSS绘制小黄人

通过CSS的border-radius、box-shadow等属性可以绘制卡通形象。以下是小黄人的实现代码:

css制作小黄人

<div class="minion">
  <div class="eye"></div>
  <div class="mouth"></div>
  <div class="hair"></div>
  <div class="overalls"></div>
</div>
.minion {
  position: relative;
  width: 200px;
  height: 300px;
  background-color: #F5E050;
  border-radius: 100px 100px 20px 20px;
  margin: 50px auto;
}

.eye {
  position: absolute;
  width: 60px;
  height: 60px;
  background: white;
  border-radius: 50%;
  top: 70px;
  left: 70px;
  box-shadow: inset 0 0 0 10px #333, 
              inset 0 0 0 20px white;
}

.mouth {
  position: absolute;
  width: 80px;
  height: 20px;
  background: #333;
  border-radius: 0 0 40px 40px;
  top: 180px;
  left: 60px;
}

.hair {
  position: absolute;
  width: 40px;
  height: 20px;
  background: #333;
  border-radius: 20px 20px 0 0;
  top: 30px;
  left: 80px;
}

.overalls {
  position: absolute;
  width: 180px;
  height: 100px;
  background: #1E88E5;
  border-radius: 0 0 20px 20px;
  bottom: 0;
  left: 10px;
}

添加动画效果

为小黄人添加眨眼动画:

css制作小黄人

@keyframes blink {
  0%, 100% { height: 60px; }
  50% { height: 10px; }
}

.eye {
  animation: blink 3s infinite;
}

响应式调整

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

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

进阶细节处理

添加更多细节使形象更生动:

.minion::after {
  content: "";
  position: absolute;
  width: 30px;
  height: 40px;
  background: #1E88E5;
  top: 220px;
  left: 85px;
  border-radius: 10px;
}

通过组合基本几何形状和CSS变换,可以创建出各种卡通形象。调整颜色、尺寸和位置参数可获得不同风格效果。

标签: 小黄css
分享给朋友:

相关文章

css制作教程

css制作教程

CSS 基础概念 CSS(层叠样式表)用于控制网页的视觉表现,包括布局、颜色、字体等。它与HTML结合使用,HTML负责结构,CSS负责样式。 基本语法结构 CSS规则由选择器和声明块组成: 选择…

css字体制作

css字体制作

CSS字体设置基础 在CSS中设置字体主要通过font-family属性实现,可以指定多个字体作为备选。系统会优先使用第一个可用字体。 body { font-family: "Helvetic…

vue制作css

vue制作css

在Vue中制作CSS的方法 Vue提供了多种灵活的方式来编写和管理CSS,可以根据项目需求选择适合的方法。 使用内联样式 内联样式可以直接在Vue组件的模板中编写,适用于简单的样式需求。 <…

css怎么制作时钟

css怎么制作时钟

使用CSS制作时钟 通过CSS和少量JavaScript可以创建一个动态时钟。以下是实现方法: HTML结构 <div class="clock"> <div class="…

css下拉箭头的制作

css下拉箭头的制作

使用伪元素制作下拉箭头 通过CSS的::after或::before伪元素结合边框属性创建箭头。设置元素的position: relative,伪元素使用绝对定位调整位置。 .dropdown {…

css如何制作未读图标

css如何制作未读图标

未读图标实现方法 通过CSS可以创建多种未读图标的样式,以下是几种常见的实现方式: 使用伪元素创建小红点 .unread-badge { position: relative; disp…