<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>QSZ新闻网</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/all.min.css">
<style>
:root {
--primary-color: #1a5f7a;
--secondary-color: #f8f9fa;
--text-color: #333;
--border-color: #dee2e6;
--accent-color: #dc3545;
--link-color: #0056b3;
}
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
line-height: 1.6;
color: var(--text-color);
background-color: var(--secondary-color);
}
/* 顶部导航栏 */
.top-bar {
background: var(--primary-color);
color: white;
padding: 0.5rem 0;
}
.top-bar-content {
max-width: 1200px;
margin: 0 auto;
display: flex;
justify-content: space-between;
align-items: center;
padding: 0 1rem;
}
.current-date {
font-size: 0.9rem;
}
.social-links a {
color: white;
margin-left: 1rem;
text-decoration: none;
}
/* 主导航栏 */
.main-header {
background: white;
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
position: sticky;
top: 0;
z-index: 100;
}
.header-content {
max-width: 1200px;
margin: 0 auto;
padding: 1rem;
display: flex;
justify-content: space-between;
align-items: center;
}
.logo {
font-size: 1.8rem;
font-weight: bold;
color: var(--primary-color);
text-decoration: none;
}
.nav-menu {
display: flex;
gap: 2rem;
}
.nav-menu a {
color: var(--text-color);
text-decoration: none;
font-weight: 500;
transition: color 0.3s;
}
.nav-menu a:hover {
color: var(--primary-color);
}
/* 主要内容区 */
.main-content {
max-width: 1200px;
margin: 2rem auto;
padding: 0 1rem;
display: grid;
grid-template-columns: 2fr 1fr;
gap: 2rem;
}
/* 头条新闻 */
.featured-news {
background: white;
border-radius: 8px;
overflow: hidden;
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
.featured-image {
width: 100%;
height: 400px;
object-fit: cover;
}
.featured-content {
padding: 1.5rem;
}
.featured-title {
font-size: 2rem;
margin-bottom: 1rem;
color: var(--primary-color);
}
.featured-excerpt {
color: #666;
margin-bottom: 1rem;
}
/* 新闻列表 */
.news-list {
display: grid;
gap: 1.5rem;
}
.news-card {
background: white;
border-radius: 8px;
overflow: hidden;
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
transition: transform 0.3s;
}
.news-card:hover {
transform: translateY(-5px);
}
.news-image {
width: 100%;
height: 200px;
object-fit: cover;
}
.news-content {
padding: 1rem;
}
.news-category {
color: var(--accent-color);
font-size: 0.9rem;
margin-bottom: 0.5rem;
}
.news-title {
font-size: 1.2rem;
margin-bottom: 0.5rem;
color: var(--text-color);
}
.news-meta {
font-size: 0.9rem;
color: #666;
display: flex;
gap: 1rem;
}
/* 侧边栏 */
.sidebar {
display: grid;
gap: 2rem;
}
.sidebar-section {
background: white;
border-radius: 8px;
padding: 1.5rem;
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
.section-title {
font-size: 1.2rem;
color: var(--primary-color);
margin-bottom: 1rem;
padding-bottom: 0.5rem;
border-bottom: 2px solid var(--border-color);
}
.trending-list {
list-style: none;
}
.trending-item {
display: flex;
gap: 1rem;
padding: 0.8rem 0;
border-bottom: 1px solid var(--border-color);
}
.trending-number {
font-size: 1.2rem;
font-weight: bold;
color: var(--accent-color);
}
.trending-title {
color: var(--text-color);
text-decoration: none;
}
.trending-title:hover {
color: var(--link-color);
}
/* 响应式设计 */
@media (max-width: 768px) {
.main-content {
grid-template-columns: 1fr;
}
.header-content {
flex-direction: column;
gap: 1rem;
}
.nav-menu {
flex-wrap: wrap;
justify-content: center;
gap: 1rem;
}
.featured-image {
height: 300px;
}
}
</style>
</head>
<body>
<div class="top-bar">
<div class="top-bar-content">
<div class="current-date">
<i class="far fa-calendar-alt"></i>
<span id="current-date"></span>
</div>
<div class="social-links">
<a href="#"><i class="fab fa-weixin"></i></a>
<a href="#"><i class="fab fa-weibo"></i></a>
<a href="#"><i class="fas fa-rss"></i></a>
</div>
</div>
</div>
<header class="main-header">
<div class="header-content">
<a href="/" class="logo">QSZ新闻网</a>
<nav class="nav-menu">
<a href="/"><i class="fas fa-home"></i> 首页</a>
<a href="/domestic"><i class="fas fa-flag"></i> 国内</a>
<a href="/international"><i class="fas fa-globe"></i> 国际</a>
<a href="/tech"><i class="fas fa-microchip"></i> 科技</a>
<a href="/finance"><i class="fas fa-chart-line"></i> 财经</a>
<a href="/sports"><i class="fas fa-futbol"></i> 体育</a>
<a href="/entertainment"><i class="fas fa-film"></i> 娱乐</a>
</nav>
</div>
</header>
<main class="main-content">
<div class="news-main">
<article class="featured-news">
<img src="https://via.placeholder.com/800x400" alt="头条新闻" class="featured-image">
<div class="featured-content">
<h1 class="featured-title">重大突破:新能源技术创新引领未来发展</h1>
<p class="featured-excerpt">国内科研团队在新能源领域取得重大突破,这项创新技术将为未来可持续发展带来新的机遇...</p>
<div class="news-meta">
<span><i class="far fa-clock"></i> 2小时前</span>
<span><i class="far fa-eye"></i> 12,345</span>
<span><i class="far fa-comment"></i> 89</span>
</div>
</div>
</article>
<div class="news-list">
<article class="news-card">
<img src="https://via.placeholder.com/400x200" alt="新闻图片" class="news-image">
<div class="news-content">
<div class="news-category">科技</div>
<h2 class="news-title">人工智能发展迎来新机遇</h2>
<div class="news-meta">
<span><i class="far fa-clock"></i> 4小时前</span>
<span><i class="far fa-eye"></i> 8,234</span>
</div>
</div>
</article>
<article class="news-card">
<img src="https://via.placeholder.com/400x200" alt="新闻图片" class="news-image">
<div class="news-content">
<div class="news-category">财经</div>
<h2 class="news-title">全球经济复苏显现积极信号</h2>
<div class="news-meta">
<span><i class="far fa-clock"></i> 6小时前</span>
<span><i class="far fa-eye"></i> 6,789</span>
</div>
</div>
</article>
</div>
</div>
<aside class="sidebar">
<section class="sidebar-section">
<h2 class="section-title">热门排行</h2>
<ul class="trending-list">
<li class="trending-item">
<span class="trending-number">01</span>
<a href="#" class="trending-title">新能源汽车市场持续增长</a>
</li>
<li class="trending-item">
<span class="trending-number">02</span>
<a href="#" class="trending-title">教育改革新政策出台</a>
</li>
<li class="trending-item">
<span class="trending-number">03</span>
<a href="#" class="trending-title">医疗健康领域创新突破</a>
</li>
<li class="trending-item">
<span class="trending-number">04</span>
<a href="#" class="trending-title">数字经济发展新动态</a>
</li>
<li class="trending-item">
<span class="trending-number">05</span>
<a href="#" class="trending-title">环保技术创新应用</a>
</li>
</ul>
</section>
<section class="sidebar-section">
<h2 class="section-title">快速导航</h2>
<div class="quick-links">
<a href="/special/tech" class="trending-title">科技专题</a><br>
<a href="/special/finance" class="trending-title">财经观察</a><br>
<a href="/special/culture" class="trending-title">文化视角</a><br>
<a href="/special/life" class="trending-title">生活方式</a>
</div>
</section>
</aside>
</main>
<script>
// 显示当前日期
const dateElement = document.getElementById('current-date');
const options = { year: 'numeric', month: 'long', day: 'numeric', weekday: 'long' };
dateElement.textContent = new Date().toLocaleDateString('zh-CN', options);
</script>
</body>
</html>
标签:1rem,color,新闻,前端,--,首页,rem,var,font From: https://www.cnblogs.com/qsz666/p/18552499