圣诞树网页代码html5
时间: 2023-12-14 11:34:41 浏览: 76
以下是一个简单的圣诞树网页代码示例,使用HTML5和CSS3实现:
```html
<!DOCTYPE html>
<html>
<head>
<title>圣诞树</title>
<style>
body {
background-color: #1c1c1c;
}
.tree {
position: relative;
margin: 0 auto;
width: 0;
height: 0;
border-left: 50px solid transparent;
border-right: 50px solid transparent;
border-bottom: 100px solid #00ff00;
}
.tree:before {
content: "";
position: absolute;
top: -50px; left: -50px;
width: 0;
height: 0;
border-left: 50px solid transparent;
border-right: 50px solid transparent;
border-bottom: 100px solid #00ff00;
}
.tree:after {
content: "";
position: absolute;
top: -100px;
left: -100px;
width: 0;
height: 0;
border-left: 100px solid transparent;
border-right: 100px solid transparent;
border-bottom: 200px solid #00ff00; }
.star {
position: absolute;
top: -70px;
left: -15px;
width: 0;
height: 0;
border-left: 30px solid transparent;
border-right: 30px solid transparent;
border-bottom: 60px solid #ffff00;
transform: rotate(35deg);
}
.light {
position: absolute;
top: -10px;
left: -10px;
width: 20px;
height: 20px;
border-radius: 50%;
background-color: #ff0000;
box-shadow: 0 0 20px #ff0000;
animation: blink 1s infinite;
}
.light:nth-child(2) {
top: -20px;
left: 30px;
animation-delay: 0.5s;
}
.light:nth-child(3) {
top: -40px;
left: -20px;
animation-delay: 0.8s;
}
@keyframes blink {
0% {
opacity: 0;
}
50% {
opacity: 1;
}
100% {
opacity: 0;
}
}
</style>
</head>
<body>
<div class="tree">
<div class="star"></div>
<div class="light"></div>
<div class="light"></div>
<div class="light"></div>
</div>
</body>
</html>
```