css制作鸟
使用CSS绘制鸟的步骤
通过CSS的border、transform和伪元素可以实现简单的鸟形图案。以下是一个基础的实现方案:
HTML结构

<div class="bird"></div>
CSS样式

.bird {
position: relative;
width: 60px;
height: 40px;
}
.bird::before,
.bird::after {
content: "";
position: absolute;
}
/* 鸟身 */
.bird::before {
width: 30px;
height: 25px;
background: #3498db;
border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
top: 5px;
left: 15px;
}
/* 鸟嘴 */
.bird::after {
width: 0;
height: 0;
border-left: 10px solid #e67e22;
border-top: 5px solid transparent;
border-bottom: 5px solid transparent;
top: 15px;
left: 45px;
}
进阶版本(带翅膀动画)
增加翅膀扇动效果需使用@keyframes:
.bird {
/* 基础样式同上 */
animation: flap 0.8s infinite alternate;
}
@keyframes flap {
0% { transform: translateY(0); }
100% { transform: translateY(-10px); }
}
/* 添加翅膀元素 */
.wing {
position: absolute;
width: 20px;
height: 15px;
background: #2980b9;
border-radius: 100% 0;
top: 10px;
left: 5px;
animation: wingFlap 0.4s infinite alternate;
}
@keyframes wingFlap {
0% { transform: rotate(0deg); }
100% { transform: rotate(20deg); }
}
简化方案(纯边框实现)
仅用单个元素通过边框创造鸟的轮廓:
.minimal-bird {
width: 0;
height: 0;
border-left: 15px solid transparent;
border-right: 25px solid #3498db;
border-top: 10px solid transparent;
border-bottom: 10px solid transparent;
border-radius: 50%;
position: relative;
}
关键技巧
- 使用
border-radius控制身体曲线 - 伪元素构建多个部件(嘴、眼睛等)
transform: rotate()调整翅膀角度- 动画通过
alternate实现往复效果
可通过调整颜色、尺寸和动画参数自定义不同风格的鸟形图案。对于更复杂的图形,建议结合SVG实现。






