我来为您创建一个具有背景对联效果的精美网页,这个设计将包含传统中国风元素,配合现代化的交互效果。

(图片来源网络,侵删)
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">新春对联 - 背景效果展示</title>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: 'Microsoft YaHei', 'SimSun', serif;
background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
min-height: 100vh;
overflow-x: hidden;
position: relative;
}
/* 背景装饰元素 */
.bg-decoration {
position: fixed;
width: 100%;
height: 100%;
top: 0;
left: 0;
z-index: 1;
pointer-events: none;
}
.bg-decoration::before {
content: '';
position: absolute;
width: 200%;
height: 200%;
background: radial-gradient(circle, rgba(255, 215, 0, 0.1) 0%, transparent 70%);
animation: float 20s infinite ease-in-out;
}
@keyframes float {
0%, 100% { transform: translate(-50%, -50%) rotate(0deg); }
50% { transform: translate(-50%, -50%) rotate(180deg); }
}
/* 主容器 */
.main-container {
position: relative;
z-index: 10;
min-height: 100vh;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding: 20px;
}
/* 对联容器 */
.couplet-container {
display: flex;
justify-content: center;
align-items: center;
gap: 80px;
margin-bottom: 60px;
position: relative;
}
/* 对联样式 */
.couplet {
background: linear-gradient(135deg, #8B0000 0%, #DC143C 100%);
padding: 40px 60px;
border-radius: 10px;
box-shadow: 0 15px 35px rgba(0, 0, 0, 0.5);
position: relative;
transform: perspective(1000px) rotateY(-5deg);
transition: all 0.3s ease;
max-width: 300px;
}
.couplet:hover {
transform: perspective(1000px) rotateY(0deg) scale(1.05);
box-shadow: 0 20px 40px rgba(220, 20, 60, 0.6);
}
.couplet.right {
transform: perspective(1000px) rotateY(5deg);
}
.couplet.right:hover {
transform: perspective(1000px) rotateY(0deg) scale(1.05);
}
/* 对联装饰边框 */
.couplet::before {
content: '';
position: absolute;
top: -5px;
left: -5px;
right: -5px;
bottom: -5px;
background: linear-gradient(45deg, #FFD700, #FFA500, #FFD700);
border-radius: 10px;
z-index: -1;
opacity: 0;
transition: opacity 0.3s ease;
}
.couplet:hover::before {
opacity: 1;
}
/* 对联文字 */
.couplet-text {
color: #FFD700;
font-size: 36px;
font-weight: bold;
text-align: center;
line-height: 1.6;
text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
letter-spacing: 8px;
}
/* 横批容器 */
.horizontal-scroll {
background: linear-gradient(135deg, #B22222 0%, #DC143C 100%);
padding: 20px 100px;
border-radius: 50px;
box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
position: relative;
transform: rotateX(10deg);
transition: all 0.3s ease;
}
.horizontal-scroll:hover {
transform: rotateX(0deg) scale(1.05);
box-shadow: 0 15px 35px rgba(220, 20, 60, 0.6);
}
.horizontal-scroll::before {
content: '';
position: absolute;
top: -3px;
left: -3px;
right: -3px;
bottom: -3px;
background: linear-gradient(45deg, #FFD700, #FFA500, #FFD700);
border-radius: 50px;
z-index: -1;
opacity: 0;
transition: opacity 0.3s ease;
}
.horizontal-scroll:hover::before {
opacity: 1;
}
.horizontal-text {
color: #FFD700;
font-size: 48px;
font-weight: bold;
text-align: center;
text-shadow: 3px 3px 6px rgba(0, 0, 0, 0.5);
letter-spacing: 20px;
}
/* 装饰元素 */
.decoration {
position: absolute;
width: 100px;
height: 100px;
background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><circle cx="50" cy="50" r="45" fill="%23FFD700" opacity="0.3"/><path d="M50 10 L60 40 L90 40 L65 60 L75 90 L50 70 L25 90 L35 60 L10 40 L40 40 Z" fill="%23FFD700"/></svg>') no-repeat center;
background-size: contain;
animation: sparkle 3s infinite;
}
.decoration.top-left {
top: 50px;
left: 50px;
}
.decoration.top-right {
top: 50px;
right: 50px;
}
.decoration.bottom-left {
bottom: 50px;
left: 50px;
}
.decoration.bottom-right {
bottom: 50px;
right: 50px;
}
@keyframes sparkle {
0%, 100% { transform: scale(1) rotate(0deg); opacity: 0.8; }
50% { transform: scale(1.2) rotate(180deg); opacity: 1; }
}
/* 内容区域 */
.content-area {
background: rgba(255, 255, 255, 0.1);
backdrop-filter: blur(10px);
border-radius: 20px;
padding: 40px;
max-width: 800px;
width: 100%;
box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
border: 1px solid rgba(255, 215, 0, 0.3);
}
.content-title {
color: #FFD700;
font-size: 32px;
text-align: center;
margin-bottom: 20px;
text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}
.content-text {
color: #FFF;
font-size: 18px;
line-height: 1.8;
text-align: center;
}
/* 烟花效果 */
.firework {
position: fixed;
width: 4px;
height: 4px;
background: #FFD700;
border-radius: 50%;
pointer-events: none;
z-index: 100;
}
/* 响应式设计 */
@media (max-width: 768px) {
.couplet-container {
flex-direction: column;
gap: 30px;
}
.couplet {
max-width: 250px;
padding: 30px 40px;
}
.couplet-text {
font-size: 28px;
letter-spacing: 4px;
}
.horizontal-scroll {
padding: 15px 60px;
}
.horizontal-text {
font-size: 36px;
letter-spacing: 12px;
}
.decoration {
width: 60px;
height: 60px;
}
}
/* 动态背景粒子 */
.particle {
position: fixed;
background: #FFD700;
border-radius: 50%;
pointer-events: none;
opacity: 0.5;
animation: particle-float 10s infinite linear;
}
@keyframes particle-float {
0% {
transform: translateY(100vh) translateX(0);
opacity: 0;
}
10% {
opacity: 0.5;
}
90% {
opacity: 0.5;
}
100% {
transform: translateY(-100vh) translateX(100px);
opacity: 0;
}
}
</style>
</head>
<body>
<!-- 背景装饰 -->
<div class="bg-decoration"></div>
<!-- 装饰元素 -->
<div class="decoration top-left"></div>
<div class="decoration top-right"></div>
<div class="decoration bottom-left"></div>
<div class="decoration bottom-right"></div>
<!-- 主容器 -->
<div class="main-container">
<!-- 对联 -->
<div class="couplet-container">
<div class="couplet left" onclick="createFirework(event)">
<div class="couplet-text">春满神州</div>
</div>
<div class="horizontal-scroll" onclick="createFirework(event)">
<div class="horizontal-text">万象更新</div>
</div>
<div class="couplet right" onclick="createFirework(event)">
<div class="couplet-text">福满人间</div>
</div>
</div>
<!-- 内容区域 -->
<div class="content-area">
<h2 class="content-title">新春祝福</h2>
<p class="content-text">
金龙献瑞迎新春,紫气东来福满门。<br>
愿您在新的一年里,身体健康,工作顺利,<br>
家庭幸福,万事如意!
</p>
</div>
</div>
<script>
// 创建烟花效果
function createFirework(event) {
const colors = ['#FFD700', '#FF6347', '#00CED1', '#32CD32', '#FF69B4'];
const particleCount = 30;
for (let i = 0; i < particleCount; i++) {
const particle = document.createElement('div');
particle.className = 'firework';
particle.style.left = event.clientX + 'px';
particle.style.top = event.clientY + 'px';
particle.style.background = colors[Math.floor(Math.random() * colors.length)];
const angle = (Math.PI * 2 * i) / particleCount;
const velocity = 100 + Math.random() * 100;
const lifetime = 1000 + Math.random() * 1000;
document.body.appendChild(particle);
let opacity = 1;
const fadeInterval = setInterval(() => {
opacity -= 0.02;
particle.style.opacity = opacity;
if (opacity <= 0) {
clearInterval(fadeInterval);
particle.remove();
}
}, 20);
const moveInterval = setInterval(() => {
const x = parseFloat(particle.style.left);
const y = parseFloat(particle.style.top);
particle.style.left = x + Math.cos(angle) * velocity / 50 + 'px';
particle.style.top = y + Math.sin(angle) * velocity / 50 + 'px';
velocity *= 0.95;
if (velocity < 1) {
clearInterval(moveInterval);
}
}, 20);
}
}
// 创建背景粒子
function createParticle() {
const particle = document.createElement('div');
particle.className = 'particle';
const size = Math.random() * 4 + 2;
particle.style.width = size + 'px';
particle.style.height = size + 'px';
particle.style.left = Math.random() * window.innerWidth + 'px';
particle.style.animationDuration = (Math.random() * 10 + 10) + 's';
particle.style.animationDelay = Math.random() * 5 + 's';
document.body.appendChild(particle);
setTimeout(() => {
particle.remove();
}, 20000);
}
// 定期创建粒子
setInterval(createParticle, 2000);
// 页面加载动画
window.addEventListener('load', () => {
const couplets = document.querySelectorAll('.couplet');
const horizontalScroll = document.querySelector('.horizontal-scroll');
couplets.forEach((couplet, index) => {
couplet.style.opacity = '0';
couplet.style.transform = 'translateY(50px)';
setTimeout(() => {
couplet.style.transition = 'all 0.8s ease';
couplet.style.opacity = '1';
couplet.style.transform = 'translateY(0)';
}, index * 200);
});
setTimeout(() => {
horizontalScroll.style.transition = 'all 0.8s ease';
horizontalScroll.style.opacity = '1';
horizontalScroll.style.transform = 'rotateX(0deg)';
}, 600);
});
// 鼠标移动视差效果
document.addEventListener('mousemove', (e) => {
const x = (e.clientX / window.innerWidth - 0.5) * 20;
const y = (e.clientY / window.innerHeight - 0.5) * 20;
const couplets = document.querySelectorAll('.couplet');
couplets.forEach((couplet, index) => {
const factor = index === 0 ? -1 : 1;
couplet.style.transform = `perspective(1000px) rotateY(${x * factor}deg) translateX(${y * factor}px)`;
});
});
</script>
</body>
</html>
这个网页实现了以下特色功能:
- 传统对联布局 - 左右对联加中间横批的经典布局
- 3D视觉效果 - 对联具有3D透视效果,鼠标移动时有视差响应
- 交互式烟花 - 点击对联或横批会触发烟花爆炸效果
- 动态背景 - 包含浮动光晕和上升粒子效果
- 精美装饰 - 四角有闪烁的星星装饰元素
- 悬停动画 - 鼠标悬停时对联会放大并显示金色边框
- 响应式设计 - 适配移动设备,自动调整布局
- 渐变背景 - 深蓝色渐变背景营造夜晚氛围
整体设计融合了中国传统元素和现代网页技术,创造出富有节日氛围的视觉效果,您可以根据需要修改对联文字、颜色方案或添加更多交互功能。

(图片来源网络,侵删)
