做一个论坛网页给我 HTML编写 单文件 功能齐全 界面美观
- User
做一个论坛网页给我 HTML编写 单文件 功能齐全 界面美观
Assistant
论坛网页 HTML 单文件实现
以下是一个功能齐全、界面美观的论坛网页的HTML单文件实现。这个文件包含了HTML、CSS和JavaScript,实现了论坛的基本功能:帖子列表、发帖、回复、用户登录等。
<!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> :root { --primary-color: #3498db; --secondary-color: #2980b9; --accent-color: #e74c3c; --light-color: #ecf0f1; --dark-color: #2c3e50; --gray-color: #95a5a6; --success-color: #2ecc71; } * { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; } body { background-color: #f5f5f5; color: #333; line-height: 1.6; } .container { max-width: 1200px; margin: 0 auto; padding: 0 20px; } /* 导航栏 */ header { background-color: var(--dark-color); color: white; padding: 15px 0; box-shadow: 0 2px 5px rgba(0,0,0,0.1); } .navbar { display: flex; justify-content: space-between; align-items: center; } .logo { font-size: 24px; font-weight: bold; color: white; text-decoration: none; } .logo span { color: var(--primary-color); } .nav-links { display: flex; list-style: none; } .nav-links li { margin-left: 20px; } .nav-links a { color: white; text-decoration: none; font-weight: 500; transition: color 0.3s; } .nav-links a:hover { color: var(--primary-color); } .user-info { display: flex; align-items: center; } .user-info img { width: 30px; height: 30px; border-radius: 50%; margin-right: 10px; } /* 主要内容 */ main { padding: 30px 0; } .forum-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; } .forum-title { font-size: 28px; color: var(--dark-color); } .btn { display: inline-block; padding: 10px 20px; background-color: var(--primary-color); color: white; border: none; border-radius: 4px; cursor: pointer; text-decoration: none; font-weight: 500; transition: background-color 0.3s; } .btn:hover { background-color: var(--secondary-color); } .btn-danger { background-color: var(--accent-color); } .btn-danger:hover { background-color: #c0392b; } .btn-success { background-color: var(--success-color); } .btn-success:hover { background-color: #27ae60; } /* 帖子列表 */ .thread-list { background-color: white; border-radius: 8px; box-shadow: 0 2px 10px rgba(0,0,0,0.05); overflow: hidden; } .thread-header { display: flex; padding: 15px 20px; background-color: var(--light-color); font-weight: bold; border-bottom: 1px solid #ddd; } .thread-title { flex: 3; } .thread-author, .thread-replies, .thread-views, .thread-last-reply { flex: 1; text-align: center; } .thread-item { display: flex; padding: 15px 20px; border-bottom: 1px solid #eee; transition: background-color 0.2s; } .thread-item:hover { background-color: #f9f9f9; } .thread-item-content { flex: 3; display: flex; align-items: center; } .thread-item-content img { width: 40px; height: 40px; border-radius: 50%; margin-right: 15px; } .thread-item-title { font-weight: 500; color: var(--dark-color); text-decoration: none; } .thread-item-title:hover { color: var(--primary-color); } .thread-item-meta { font-size: 14px; color: var(--gray-color); margin-top: 5px; } .thread-item-stats { flex: 1; text-align: center; color: var(--gray-color); font-size: 14px; display: flex; flex-direction: column; justify-content: center; } /* 分页 */ .pagination { display: flex; justify-content: center; margin-top: 30px; } .pagination a { padding: 8px 16px; margin: 0 5px; border: 1px solid #ddd; color: var(--primary-color); text-decoration: none; border-radius: 4px; transition: background-color 0.3s; } .pagination a.active { background-color: var(--primary-color); color: white; border-color: var(--primary-color); } .pagination a:hover:not(.active) { background-color: #f1f1f1; } /* 帖子详情 */ .thread-detail { background-color: white; border-radius: 8px; box-shadow: 0 2px 10px rgba(0,0,0,0.05); padding: 20px; margin-bottom: 30px; } .thread-header-detail { padding-bottom: 20px; border-bottom: 1px solid #eee; margin-bottom: 20px; } .thread-header-detail h1 { font-size: 24px; margin-bottom: 10px; color: var(--dark-color); } .thread-meta { display: flex; align-items: center; color: var(--gray-color); font-size: 14px; } .thread-meta img { width: 40px; height: 40px; border-radius: 50%; margin-right: 10px; } .thread-content { padding: 20px 0; line-height: 1.8; } .thread-actions { display: flex; justify-content: flex-end; margin-top: 20px; } /* 回复列表 */ .reply-list { background-color: white; border-radius: 8px; box-shadow: 0 2px 10px rgba(0,0,0,0.05); } .reply-item { padding: 20px; border-bottom: 1px solid #eee; } .reply-header { display: flex; align-items: center; margin-bottom: 15px; } .reply-header img { width: 40px; height: 40px; border-radius: 50%; margin-right: 10px; } .reply-author { font-weight: 500; color: var(--dark-color); } .reply-date { font-size: 14px; color: var(--gray-color); margin-left: 10px; } .reply-content { line-height: 1.8; } /* 回复表单 */ .reply-form { background-color: white; border-radius: 8px; box-shadow: 0 2px 10px rgba(0,0,0,0.05); padding: 20px; margin-top: 30px; } .reply-form h3 { margin-bottom: 20px; color: var(--dark-color); } .form-group { margin-bottom: 20px; } .form-group label { display: block; margin-bottom: 8px; font-weight: 500;
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.