<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>仰视无缝滚动背景特效</title>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
overflow: hidden;
height: 100vh;
perspective: 1000px;
background: #000;
}
.sky-container {
position: absolute;
width: 100%;
height: 200%;
transform-style: preserve-3d;
transform: rotateX(75deg) translateZ(-300px);
animation: scrollSky 60s linear infinite;
}
.sky-layer {
position: absolute;
width: 100%;
height: 100%;
background-size: cover;
background-repeat: repeat;
transform-style: preserve-3d;
}
.layer-1 {
background-image: url('https://source.unsplash.com/random/1920x1080?stars');
transform: translateZ(-500px);
opacity: 0.8;
filter: brightness(1.2);
}
.layer-2 {
background-image: url('https://source.unsplash.com/random/1920x1080?clouds');
transform: translateZ(-300px);
opacity: 0.6;
animation: pulse 8s ease-in-out infinite alternate;
}
.layer-3 {
background-image: url('https://source.unsplash.com/random/1920x1080?nightcity');
transform: translateZ(-100px);
opacity: 0.9;
}
.content {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
color: white;
text-align: center;
z-index: 100;
text-shadow: 0 0 10px rgba(0,0,0,0.8);
font-family: 'Arial', sans-serif;
}
.content h1 {
font-size: 3rem;
margin-bottom: 1rem;
}
.content p {
font-size: 1.2rem;
max-width: 600px;
margin: 0 auto 2rem;
}
.btn {
display: inline-block;
padding: 12px 30px;
background: rgba(255,255,255,0.2);
color: white;
text-decoration: none;
border-radius: 30px;
border: 1px solid rgba(255,255,255,0.4);
transition: all 0.3s ease;
backdrop-filter: blur(5px);
}
.btn:hover {
background: rgba(255,255,255,0.4);
transform: translateY(-3px);
}
.link {
position: absolute;
bottom: 20px;
right: 20px;
color: rgba(255,255,255,0.7);
font-family: Arial, sans-serif;
text-decoration: none;
z-index: 1000;
transition: color 0.3s ease;
}
.link:hover {
color: #fff;
}
@keyframes scrollSky {
0% {
transform: rotateX(75deg) translateZ(-300px) translateY(0);
}
100% {
transform: rotateX(75deg) translateZ(-300px) translateY(-50%);
}
}
@keyframes pulse {
0% {
opacity: 0.5;
}
100% {
opacity: 0.8;
}
}
</style>
</head>
<body>
<div class="sky-container">
<div class="sky-layer layer-1"></div>
<div class="sky-layer layer-2"></div>
<div class="sky-layer layer-3"></div>
</div>
<div class="content">
<h1>仰望星空</h1>
<p>在这浩瀚宇宙中,感受无限可能。我们的视角决定了我们能看到的世界。</p>
<a href="#" class="btn">探索更多</a>
</div>
</body>
</html>
仰视无缝滚动背景特效
于 2025-06-09 17:21:29 首次发布