网页
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>D24c04430谢圣生</title>
<style>
:root {
--primary-color: #1890ff;
--hover-color: #40a9ff;
--danger-color: #ff4d4f;
--danger-hover: #ff7875;
--text-color: #333;
--light-text: #999;
--border-color: #eee;
--bg-color: #f5f5f5;
}
* {
box-sizing: border-box;
padding: 0;
margin: 0;
transition: all 0.3s ease;
}
a {
text-decoration: none;
color: var(--text-color);
}
body {
font-family: 'Microsoft YaHei', 'PingFang SC', sans-serif;
background-color: var(--bg-color);
color: var(--text-color);
line-height: 1.6;
}
.banxin {
width: min(1000px, 90%);
margin: 0 auto;
padding: 0 15px;
}
.header {
height: 75px;
padding: 15px 0;
background: #fff;
box-shadow: 0 2px 10px rgba(0,0,0,0.1);
margin-bottom: 20px;
position: sticky;
top: 0;
z-index: 100;
}
.header-container {
display: flex;
justify-content: space-between;
align-items: center;
}
.header img {
height: 50px;
object-fit: contain;
}
.nav-links {
display: flex;
align-items: center;
gap: 15px;
}
.nav-links a {
color: #666;
font-size: 14px;
padding: 5px 10px;
border-radius: 4px;
}
.nav-links a:hover {
color: var(--primary-color);
background: rgba(24, 144, 255, 0.1);
}
.dropdown {
position: relative;
}
.dropdown-content {
display: none;
position: absolute;
right: 0;
background: #fff;
min-width: 120px;
box-shadow: 0 4px 12px rgba(0,0,0,0.15);
border-radius: 6px;
overflow: hidden;
z-index: 10;
}
.dropdown:hover .dropdown-content {
display: block;
animation: fadeIn 0.3s;
}
@keyframes fadeIn {
from { opacity: 0; transform: translateY(-10px); }
to { opacity: 1; transform: translateY(0); }
}
.dropdown-content a {
display: block;
padding: 10px 15px;
color: #666;
}
.dropdown-content a:hover {
background: rgba(24, 144, 255, 0.05);
color: var(--primary-color);
}
.carousel {
width: 100%;
height: 300px;
margin: 20px 0;
border-radius: 8px;
overflow: hidden;
position: relative;
box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}
.carousel img {
width: 100%;
height: 100%;
object-fit: cover;
transition: opacity 0.5s ease;
}
.lyb {
background: #fff;
padding: 30px;
border-radius: 8px;
box-shadow: 0 2px 10px rgba(0,0,0,0.05);
margin-bottom: 30px;
}
.lyb h1 {
color: var(--text-color);
margin-bottom: 25px;
padding-bottom: 15px;
border-bottom: 1px solid var(--border-color);
font-size: 24px;
font-weight: 600;
}
.message-list {
margin: 20px 0;
min-height: 100px;
list-style: none;
}
.message-item {
padding: 15px;
border-bottom: 1px solid var(--border-color);
display: flex;
justify-content: space-between;
align-items: center;
}
.message-item:hover {
background: rgba(245, 245, 245, 0.5);
}
.message-content {
flex: 1;
word-break: break-word;
}
.message-meta {
display: flex;
align-items: center;
gap: 10px;
}
.message-time {
color: var(--light-text);
font-size: 12px;
white-space: nowrap;
}
.message-input {
width: 100%;
height: 120px;
padding: 15px;
margin-bottom: 15px;
border: 1px solid #ddd;
border-radius: 6px;
resize: vertical;
font-size: 14px;
font-family: inherit;
}
.message-input:focus {
border-color: var(--primary-color);
box-shadow: 0 0 0 3px rgba(24, 144, 255, 0.2);
outline: none;
}
.btn {
padding: 10px 25px;
border: none;
border-radius: 6px;
cursor: pointer;
font-size: 16px;
font-weight: 500;
}
.btn-primary {
background: var(--primary-color);
color: white;
}
.btn-primary:hover {
background: var(--hover-color);
}
.btn-danger {
background: var(--danger-color);
color: white;
font-size: 12px;
padding: 5px 10px;
}
.btn-danger:hover {
background: var(--danger-hover);
}
.divider {
color: #ddd;
user-select: none;
}
@media (max-width: 768px) {
.banxin {
width: 95%;
}
.header img {
height: 40px;
}
.carousel {
height: 200px;
}
.nav-links {
gap: 8px;
}
}
</style>
</head>
<body>
<div class="header">
<div class="banxin header-container">
<img src="https://odocs.top/zb_users/upload/2025/06/logo_cn.png" alt="网站Logo">
<div class="nav-links">
<div class="dropdown">
<a href="#">语言 ▼</a>
<div class="dropdown-content">
<a href="#">简体中文</a>
<a href="#">English</a>
<a href="#">日本語</a>
</div>
</div>
<span class="divider">|</span>
<a href="#">加入收藏</a>
<span class="divider">|</span>
<a href="#">设为首页</a>
</div>
</div>
</div>
<div class="banxin">
<div class="carousel">
<img src="img/z-1.jpg" id="carousel-img">
</div>
<div class="lyb">
<h1>留言板</h1>
<ul class="message-list" id="messageList"></ul>
<textarea class="message-input" id="messageInput" placeholder="请输入留言内容..."></textarea>
<button class="btn btn-primary" onclick="addMessage()">提交留言</button>
</div>
</div>
<script>
// 轮播图功能
var images = [
"img/z-1.jpg",
"img/z-2.jpg",
"img/z-3.jpg",
"img/z-4.jpg"
];
var currentIndex = 0;
var carouselImg = document.getElementById('carousel-img');
function changeImage() {
currentIndex = (currentIndex + 1) % images.length;
carouselImg.style.opacity = 0;
setTimeout(() => {
carouselImg.src = images[currentIndex];
carouselImg.style.opacity = 1;
}, 500);
}
setInterval(changeImage, 3000);
// 留言板功能
function addMessage() {
var input = document.getElementById('messageInput');
var message = input.value.trim();
if(!message) {
alert('留言内容不能为空');
return;
}
var list = document.getElementById('messageList');
var li = document.createElement('li');
li.className = 'message-item';
var now = new Date();
var timeString = now.toLocaleString('zh-CN', {
year: 'numeric',
month: '2-digit',
day: '2-digit',
hour: '2-digit',
minute: '2-digit',
hour12: false
});
li.innerHTML = `
<div class="message-content">${message}</div>
<div class="message-meta">
<span class="message-time">${timeString}</span>
<button class="btn btn-danger" onclick="this.closest('li').remove()">删除</button>
</div>
`;
list.prepend(li);
input.value = '';
input.focus();
}
document.getElementById('messageInput').addEventListener('keydown', function(e) {
if(e.key === 'Enter' && !e.shiftKey) {
e.preventDefault();
addMessage();
}
});
</script>
</body>
</html>
打赏

微信扫一扫,打赏作者吧~