html制作樱花插入图片
时间: 2023-06-11 12:08:50 浏览: 79
你可以使用以下代码来制作樱花并插入图片:
```html
<!DOCTYPE html>
<html>
<head>
<title>Sakura Cherry Blossoms</title>
<style>
body {
background-color: #f5f5f5;
}
.sakura {
position: absolute;
top: -10px;
animation-name: fall;
animation-duration: 8s;
animation-timing-function: ease-in-out;
animation-iteration-count: infinite;
}
@keyframes fall {
0% {
transform: translate(0, -100px);
}
100% {
transform: translate(0, 1000px);
}
}
</style>
</head>
<body>
<img src="your_image_url_here" alt="your_image_description_here" width="500" height="auto">
<div class="sakura">
<img src="https://i.imgur.com/5q5zKtU.png" alt="sakura_cherry_blossom" width="50" height="50">
</div>
<script>
// Add Sakura Cherry Blossoms
for (let i = 0; i < 30; i++) {
setTimeout(addSakura, i * 300);
}
function addSakura() {
let sakura = document.createElement("div");
sakura.classList.add("sakura");
sakura.style.left = Math.random() * window.innerWidth + "px";
sakura.style.animationDelay = Math.random() * 5 + "s";
document.body.appendChild(sakura);
}
</script>
</body>
</html>
```
你只需要将 `your_image_url_here` 替换为你自己的图片链接,就可以在页面上插入你的图片并让樱花飘落了。
相关推荐
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)