/* 全局样式 */ * { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Arial', sans-serif; } body { background-color: #f5f5f5; color: #333; line-height: 1.6; display: flex; flex-direction: column; min-height: 100vh; } a { text-decoration: none; color: #333; } ul { list-style: none; } .container { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 20px; } /* 头部样式 */ header { background-color: #fff; box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1); padding: 15px 0; position: sticky; top: 0; z-index: 100; } .header-content { display: flex; justify-content: space-between; align-items: center; } .logo { font-size: 24px; font-weight: bold; color: #2c3e50; } .nav-links { display: flex; gap: 30px; } .nav-links a { transition: color 0.3s; } .nav-links a:hover { color: #3498db; } .search-box { position: relative; width: 300px; } .search-box input { width: 100%; padding: 10px 15px; border: 1px solid #ddd; border-radius: 20px; outline: none; font-size: 14px; } .search-box button { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); background: none; border: none; cursor: pointer; color: #999; } .profile { display: flex; align-items: center; gap: 10px; } .profile-img { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; } /* 主要内容区 */ main { padding: 30px 0; flex: 1; } /* 底部样式 */ footer { background-color: #2c3e50; color: #fff; padding: 30px 0; margin-top: auto; } .footer-content { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 30px; } .footer-section { margin-bottom: 20px; } .footer-section h3 { margin-bottom: 15px; font-size: 18px; color: #ecf0f1; } .footer-links a { display: block; margin-bottom: 10px; color: #bdc3c7; transition: color 0.3s; } .footer-links a:hover { color: #ecf0f1; } .copyright { text-align: center; margin-top: 30px; padding-top: 20px; border-top: 1px solid rgba(255, 255, 255, 0.1); color: #bdc3c7; font-size: 14px; } /* 响应式设计 */ @media (max-width: 768px) { .header-content { flex-direction: column; gap: 15px; } .nav-links { order: 1; width: 100%; justify-content: center; margin-bottom: 10px; } .search-box { width: 100%; order: 2; } .profile { order: 3; } .article-list { grid-template-columns: 1fr; } .article-content { flex-direction: column; } .article-image { width: 100%; height: 200px; } .article-info { padding-left: 0; padding-top: 15px; } }