圣诞树代码html源码
时间: 2023-03-29 19:01:58 浏览: 246
以下是一个简单的圣诞树 HTML 代码:
```
<!DOCTYPE html>
<html>
<head>
<title>圣诞树</title>
<style>
body {
background-color: #1a1a1a;
}
.tree {
position: relative;
margin: auto;
width: ;
height: ;
border-left: 200px solid transparent;
border-right: 200px solid transparent;
border-bottom: 300px solid #00cc00;
}
.star {
position: absolute;
top: -50px;
left: 175px;
width: 50px;
height: 50px;
background-color: yellow;
border-radius: 50%;
transform: rotate(45deg);
}
.bulb {
position: absolute;
width: 20px;
height: 20px;
border-radius: 50%;
background-color: red;
animation: blink 1s infinite;
}
.bulb1 {
top: 100px;
left: 140px;
}
.bulb2 {
top: 150px;
left: 180px;
}
.bulb3 {
top: 200px;
left: 120px;
}
.bulb4 {
top: 250px;
left: 160px;
}
.bulb5 {
top: 300px;
left: 100px;
}
.bulb6 {
top: 350px;
left: 140px;
}
.bulb7 {
top: 400px;
left: 180px;
}
.bulb8 {
top: 450px;
left: 120px;
}
.bulb9 {
top: 500px;
left: 160px;
}
@keyframes blink {
% {
opacity: .2;
}
50% {
opacity: 1;
}
100% {
opacity: .2;
}
}
</style>
</head>
<body>
<div class="tree">
<div class="star"></div>
</div>
<div class="bulb bulb1"></div>
<div class="bulb bulb2"></div>
<div class="bulb bulb3"></div>
<div class="bulb bulb4"></div>
<div class="bulb bulb5"></div>
<div class="bulb bulb6"></div>
<div class="bulb bulb7"></div>
<div class="bulb bulb8"></div>
<div class="bulb bulb9"></div>
</body>
</html>
```
阅读全文