hbuilderx圣诞树代码
时间: 2023-12-07 10:39:05 浏览: 71
以下是使用HBuilderX实现的圣诞树代码:
```html
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>圣诞树</title>
<style>
body {
background-color: #000;
}
.tree {
position: absolute; top: 50%;
left: 50%;
margin-top: -150px;
margin-left: -150px;
width: 300px;
height: 300px;
background-color: #fff;
border-radius: 0 0 150px 150px;
overflow: hidden;
}
.tree:before {
content: '';
position: absolute;
top: -50px;
left: 0;
width: 0;
height: 0;
border-left: 150px solid transparent;
border-right: 150px solid transparent;
border-bottom: 50px solid #00a651;
}
.tree:after {
content: '';
position: absolute;
top: 0;
left: 50%;
margin-left: -50px;
width: 100px;
height: 100px;
background-color: #fff;
border-radius: 50%;
box-shadow: 0 0 50px #00a651;
}
.tree .star {
position: absolute;
top: -25px;
left: 50%;
margin-left: -15px;
width: 0;
height: 0;
border-left: 15px solid transparent;
border-right: 15px solid transparent;
border-bottom: 25px solid #f1c40f;
transform: rotate(45deg);
}
.tree ul {
margin: 0;
padding: 0;
list-style: none;
position: absolute;
bottom: 0;
left: 50%;
margin-left: -75px;
text-align: center;
}
.tree ul li {
display: inline-block;
margin: 0 7.5px;
position: relative;
bottom: 0;
width: 15px;
height: 20px;
background-color: #e74c3c;
border-radius: 5px;
animation: light 2s ease-in-out infinite;
}
.tree ul li:nth-child(1) {
animation-delay: 0s;
}
.tree ul li:nth-child(2) {
animation-delay: 0.2s;
}
.tree ul li:nth-child(3) {
animation-delay: 0.4s;
}
.tree ul li:nth-child(4) {
animation-delay: 0.6s;
}
.tree ul li:nth-child(5) {
animation-delay: 0.8s;
}
.tree ul li:nth-child(6) {
animation-delay: 1s;
}
.tree ul li:nth-child(7) {
animation-delay: 1.2s;
}
.tree ul li:nth-child(8) {
animation-delay: 1.4s;
}
.tree ul li:nth-child(9) {
animation-delay: 1.6s;
}
.tree ul li:nth-child(10) {
animation-delay: 1.8s;
}
.tree ul li:nth-child(11) {
animation-delay: 2s;
}
.tree ul li:nth-child(12) {
animation-delay: 2.2s;
}
.tree ul li:nth-child(13) {
animation-delay: 2.4s;
}
.tree ul li:nth-child(14) {
animation-delay: 2.6s;
}
.tree ul li:nth-child(15) {
animation-delay: 2.8s;
}
.tree ul li:nth-child(16) {
animation-delay: 3s;
}
.tree ul li:nth-child(17) {
animation-delay: 3.2s;
}
.tree ul li:nth-child(18) {
animation-delay: 3.4s;
}
.tree ul li:nth-child(19) {
animation-delay: 3.6s;
}
.tree ul li:nth-child(20) {
animation-delay: 3.8s;
}
.tree ul li:nth-child(21) {
animation-delay: 4s;
}
.tree ul li:nth-child(22) {
animation-delay: 4.2s;
}
.tree ul li:nth-child(23) {
animation-delay: 4.4s;
}
.tree ul li:nth-child(24) {
animation-delay: 4.6s;
}
.tree ul li:nth-child(25) {
animation-delay: 4.8s;
}
.tree ul li:nth-child(26) {
animation-delay: 5s;
}
.tree ul li:nth-child(27) {
animation-delay: 5.2s;
}
.tree ul li:nth-child(28) {
animation-delay: 5.4s;
}
.tree ul li:nth-child(29) {
animation-delay: 5.6s;
}
.tree ul li:nth-child(30) {
animation-delay: 5.8s;
}
.tree ul li:nth-child(31) {
animation-delay: 6s;
}
.tree ul li:nth-child(32) {
animation-delay: 6.2s;
}
.tree ul li:nth-child(33) {
animation-delay: 6.4s;
}
.tree ul li:nth-child(34) {
animation-delay: 6.6s;
}
.tree ul li:nth-child(35) {
animation-delay: 6.8s;
}
.tree ul li:nth-child(36) {
animation-delay: 7s;
}
.tree ul li:nth-child(37) {
animation-delay: 7.2s;
}
.tree ul li:nth-child(38) {
animation-delay: 7.4s;
}
.tree ul li:nth-child(39) {
animation-delay: 7.6s;
}
.tree ul li:nth-child(40) {
animation-delay: 7.8s;
}
.tree ul li:nth-child(41) {
animation-delay: 8s;
}
.tree ul li:nth-child(42) {
animation-delay: 8.2s;
}
.tree ul li:nth-child(43) {
animation-delay: 8.4s;
}
.tree ul li:nth-child(44) {
animation-delay: 8.6s;
}
.tree ul li:nth-child(45) {
animation-delay: 8.8s;
}
.tree ul li:nth-child(46) {
animation-delay: 9s;
}
.tree ul li:nth-child(47) {
animation-delay: 9.2s;
}
.tree ul li:nth-child(48) {
animation-delay: 9.4s;
}
.tree ul li:nth-child(49) {
animation-delay: 9.6s;
}
.tree ul li:nth-child(50) {
animation-delay: 9.8s;
}
@keyframes light {
0% {
opacity: 0.2;
transform: translateY(0);
}
50% {
opacity: 1;
transform: translateY(-20px);
}
100% {
opacity: 0.2;
transform: translateY(0);
}
}
</style>
</head>
<body>
<div class="tree">
<div class="star"></div>
<ul>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
</ul>
</div>
</body>
</html>
```