绘制会动的可爱小狗html项目
时间: 2023-10-21 17:58:00 浏览: 97
好的,下面是一个HTML和CSS代码段,可以绘制一个可爱的小狗并且能够动起来:
```
<!DOCTYPE html>
<html>
<head>
<title>可爱小狗</title>
<style>
#dog {
position: absolute;
left: 0;
top: 0;
animation: move 5s linear infinite;
}
@keyframes move {
0% {
transform: translateX(0);
}
50% {
transform: translateX(200px);
transform-origin: 100% 50%;
-webkit-transform-origin: 100% 50%;
}
100% {
transform: translateX(0);
}
}
</style>
</head>
<body>
<div style="text-align:center;">
<svg id="dog" width="200" height="200">
<circle cx="100" cy="100" r="80" fill="#F5D0A9" />
<circle cx="70" cy="70" r="20" fill="#ffffff" />
<circle cx="130" cy="70" r="20" fill="#ffffff" />
<ellipse cx="70" cy="70" rx="10" ry="15" fill="#000000" />
<ellipse cx="130" cy="70" rx="10" ry="15" fill="#000000" />
<path d="M 100,120 C 150,120 150,150 100,150 C 50,150 50,120 100,120 Z" fill="#F5D0A9" />
<rect x="80" y="120" width="40" height="40" fill="#F5D0A9" />
</svg>
</div>
</body>
</html>
```
通过以上代码,你将看到一个类似于下图的小狗,并且它会在屏幕上移动:
![可爱小狗动画](https://img-blog.csdnimg.cn/20211019160629703.gif)