再完善一下,布局仿苹果官网
- User
再完善一下,布局仿苹果官网
Assistant
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
再完善一下,布局仿苹果官网
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
以下是一个更为完善的个人博客网页,布局仿照苹果官网的简洁和现代风格:
<!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>
/* 全局样式 */
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Microsoft YaHei', sans-serif;
line-height: 1.6;
color: #333;
background-color: #f4f4f4;
}
/* 容器样式 */
.container {
max-width: 1200px;
margin: 0 auto;
padding: 0 20px;
}
/* 导航栏样式 */
header {
background-color: #2c3e50;
color: white;
padding: 1rem 0;
position: fixed;
width: 100%;
top: 0;
z-index: 1000;
box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}
nav {
display: flex;
justify-content: space-between;
align-items: center;
}
.logo {
font-size: 1.5rem;
font-weight: bold;
}
nav ul {
list-style: none;
display: flex;
}
nav ul li {
margin-left: 2rem;
}
nav ul li a {
color: white;
text-decoration: none;
transition: color 0.3s;
}
nav ul li a:hover {
color: #3498db;
}
/* 主要内容区域 */
main {
margin-top: 80px;
padding: 2rem 0;
}
/* 个人简介部分 */
.hero {
background-image: linear-gradient(to bottom, #f4f4f4, #fff);
padding: 10rem 0;
text-align: center;
margin-bottom: 2rem;
}
.hero h1 {
font-size: 3rem;
margin-bottom: 1rem;
color: #2c3e50;
}
.hero p {
font-size: 1.2rem;
color: #7f8c8d;
max-width: 600px;
margin: 0 auto;
}
/* 博客文章列表 */
.blog-posts {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
gap: 2rem;
margin-bottom: 3rem;
}
.blog-post {
background-color: white;
padding: 2rem;
border-radius: 8px;
box-shadow: 0 2px 10px rgba(0,0,0,0.1);
transition: transform 0.3s, box-shadow 0.3s;
}
.blog-post:hover {
transform: translateY(-5px);
box-shadow: 0 5px 20px rgba(0,0,0,0.15);
}
.blog-post h2 {
color: #2c3e50;
margin-bottom: 0.5rem;
}
.post-meta {
color: #7f8c8d;
font-size: 0.9rem;
margin-bottom: 1rem;
}
.blog-post p {
color: #555;
margin-bottom: 1rem;
}
.read-more {
color: #3498db;
text-decoration: none;
font-weight: bold;
transition: color 0.3s;
}
.read-more:hover {
color: #2980b9;
}
/* 侧边栏 */
.sidebar {
background-color: white;
padding: 2rem;
border-radius: 8px;
box-shadow: 0 2px 10px rgba(0,0,0,0.1);
margin-bottom: 2rem;
}
.sidebar h3 {
color: #2c3e50;
margin-bottom: 1rem;
}
.sidebar ul {
list-style: none;
}
.sidebar ul li {
padding: 0.5rem 0;
border-bottom: 1px solid #ecf0f1;
}
.sidebar ul li:last-child {
border-bottom: none;
}
.sidebar ul li a {
color: #3498db;
text-decoration: none;
}
.sidebar ul li a:hover {
text-decoration: underline;
}
/* 页脚 */
footer {
background-color: #2c3e50;
color: white;
text-align: center;
padding: 2rem 0;
margin-top: 3rem;
}
.social-links {
margin-top: 1rem;
}
.social-links a {
color: white;
font-size: 1.5rem;
margin: 0 0.5rem;
text-decoration: none;
transition: color 0.3s;
}
.social-links a:hover {
color: #3498db;
}
/* 响应式设计 */
@media (max-width: 768px) {
nav ul li {
margin-left: 1rem;
}
.hero h1 {
font-size: 2rem;
}
.blog-posts {
grid-template-columns: 1fr;
}
}
</style>
</head>
<body>
<!-- 导航栏 -->
<header>
<nav class="container">
<div class="logo">我的博客</div>
<ul>
<li><a href="#home">首页</a></li>
<li><a href="#about">关于</a></li>
<li><a href="#blog">博客</a></li>
<li><a href="#contact">联系</a></li>
</ul>
</nav>
</header>
<!-- 主要内容 -->
<main>
<!-- 个人简介 -->
<section class="hero">
<div class="container">
<h1>欢迎来到我的个人博客</h1>
<p>分享技术、生活和思考,记录成长的点点滴滴</p>
</div>
</section>
<!-- 博客内容区 -->
<div class="container">
<div class="blog-posts">
<!-- 博客文章1 -->
<article class="blog-post">
<h2>探索人工智能的未来</h2>
<div class="post-meta">2025年5月25日 | 技术分享</div>
<p>人工智能正在改变我们的生活方式。从智能助手到自动驾驶,AI技术的应用越来越广泛。本文将探讨AI技术的最新进展和未来发展趋势...</p>
<a href="#" class="read-more">阅读更多 →</a>
</article>
<!-- 博客文章2 -->
<article class="blog-post">
<h2>Web开发最佳实践</h2>
<div class="post-meta">2025年5月20日 | 编程心得</div>
<p>在现代Web开发中,性能优化和用户体验是两个关键因素。本文将分享一些实用的开发技巧,帮助你构建更快、更好的网站...</p>
<a href="#" class="read-more">阅读更多 →</a>
</article>
<!-- 博客文章3 -->
<article class="blog-post">
<h2>远程工作的挑战与机遇</h2>
<div class="post-meta">2025年5月15日 | 生活感悟</div>
<p>远程工作已经成为新常态。如何在家中保持高效率?如何平衡工作与生活?这篇文章分享了我的一些经验和思考...</p>
<a href="#" class="read-more">阅读更多 →</a>
</article>
<!-- 侧边栏 -->
<aside class="sidebar">
<h3>热门文章</h3>
<ul>
<li><a href="#">JavaScript异步编程详解</a></li>
<li><a href="#">React Hooks使用指南</a></li>
<li><a href="#">CSS Grid布局实战</a></li>
<li><a href="#">Git工作流最佳实践</a></li>
</ul>
</aside>
</div>
</div>
</main>
<!-- 页脚 -->
<footer>
<div class="container">
<p>© 2025 我的个人博客. 保留所有权利.</p>
<div class="social-links">
<a href="#">📧</a>
你没有发完
我为之前的回复没有完整而道歉。以下是完整的代码:
<!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>
/* 全局样式 */
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Microsoft YaHei', sans-serif;
line-height: 1.6;
color: #333;
background-color: #f4f4f4;
}
/* 容器样式 */
.container {
max-width: 1200px;
margin: 0 auto;
padding: 0 20px;
}
/* 导航栏样式 */
header {
background-color: #2c3e50;
color: white;
padding: 1rem 0;
position: fixed;
width: 100%;
top: 0;
z-index: 1000;
box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}
nav {
display: flex;
justify-content: space-between;
align-items: center;
}
.logo {
font-size: 1.5rem;
font-weight: bold;
}
nav ul {
list-style: none;
display: flex;
}
nav ul li {
margin-left: 2rem;
}
nav ul li a {
color: white;
text-decoration: none;
transition: color 0.3s;
}
nav ul li a:hover {
color: #3498db;
}
/* 主要内容区域 */
main {
margin-top: 80px;
padding: 2rem 0;
}
/* 个人简介部分 */
.hero {
background-image: linear-gradient(to bottom, #f4f4f4, #fff);
padding: 10rem 0;
text-align: center;
margin-bottom: 2rem;
}
.hero h1 {
font-size: 3rem;
margin-bottom: 1rem;
color: #2c3e50;
}
.hero p {
font-size: 1.2rem;
color: #7f8c8d;
max-width: 600px;
margin: 0 auto;
}
/* 博客文章列表 */
.blog-posts {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
gap: 2rem;
margin-bottom: 3rem;
}
.blog-post {
background-color: white;
padding: 2rem;
border-radius: 8px;
box-shadow: 0 2px 10px rgba(0,0,0,0.1);
transition: transform 0.3s, box-shadow 0.3s;
}
.blog-post:hover {
transform: translateY(-5px);
box-shadow: 0 5px 20px rgba(0,0,0,0.15);
}
.blog-post h2 {
color: #2c3e50;
margin-bottom: 0.5rem;
}
.post-meta {
color: #7f8c8d;
font-size: 0.9rem;
margin-bottom: 1rem;
}
.blog-post p {
color: #555;
margin-bottom: 1rem;
}
.read-more {
color: #3498db;
text-decoration: none;
font-weight: bold;
transition: color 0.3s;
}
.read-more:hover {
color: #2980b9;
}
/* 侧边栏 */
.sidebar {
background-color: white;
padding: 2rem;
border-radius: 8px;
box-shadow: 0 2px 10px rgba(0,0,0,0.1);
margin-bottom: 2rem;
}
.sidebar h3 {
color: #2c3e50;
margin-bottom: 1rem;
}
.sidebar ul {
list-style: none;
}
.sidebar ul li {
padding: 0.5rem 0;
border-bottom: 1px solid #ecf0f1;
}
.sidebar ul li:last-child {
border-bottom: none;
}
.sidebar ul li a {
color: #3498db;
text-decoration: none;
}
.sidebar ul li a:hover {
text-decoration: underline;
}
/* 页脚 */
footer {
background-color: #2c3e50;
color: white;
text-align: center;
padding: 2rem 0;
margin-top: 3rem;
}
.social-links {
margin-top: 1rem;
}
.social-links a {
color: white;
font-size: 1.5rem;
margin: 0 0.5rem;
text-decoration: none;
transition: color 0.3s;
}
.social-links a:hover {
color: #3498db;
}
/* 响应式设计 */
@media (max-width: 768px) {
nav ul li {
margin-left: 1rem;
}
.hero h1 {
font-size: 2rem;
}
.blog-posts {
grid-template-columns: 1fr;
}
}
</style>
</head>
<body>
<!-- 导航栏 -->
<header>
<nav class="container">
<div class="logo">我的博客</div>
<ul>
<li><a href="#home">首页</a></li>
<li><a href="#about">关于</a></li>
<li><a href="#blog">博客</a></li>
<li><a href="#contact">联系</a></li>
</ul>
</nav>
</header>
<!-- 主要内容 -->
<main>
<!-- 个人简介 -->
<section class="hero">
<div class="container">
<h1>欢迎来到我的个人博客</h1>
<p>分享技术、生活和思考,记录成长的点点滴滴</p>
</div>
</section>
<!-- 博客内容区 -->
<div class="container">
<div class="blog-posts">
<!-- 博客文章1 -->
<article class="blog-post">
<h2>探索人工智能的未来</h2>
<div class="post-meta">2025年5月25日 | 技术分享</div>
<p>人工智能正在改变我们的生活方式。从智能助手到自动驾驶,AI技术的应用越来越广泛。本文将探讨AI技术的最新进展和未来发展趋势...</p>
<a href="#" class="read-more">阅读更多 →</a>
</article>
<!-- 博客文章2 -->
<article class="blog-post">
<h2>Web开发最佳实践</h2>
<div class="post-meta">2025年5月20日 | 编程心得</div>
<p>在现代Web开发中,性能优化和用户体验是两个关键因素。本文将分享一些实用的开发技巧,帮助你构建更快、更好的网站...</p>
<a href="#" class="read-more">阅读更多 →</a>
</article>
<!-- 博客文章3 -->
<article class="blog-post">
<h2>远程工作的挑战与机遇</h2>
<div class="post-meta">2025年5月15日 | 生活感悟</div>
<p>远程工作已经成为新常态。如何在家中保持高效率?如何平衡工作与生活?这篇文章分享了我的一些经验和思考...</p>
<a href="#" class="read-more">阅读更多 →</a>
</article>
<!-- 侧边栏 -->
<aside class="sidebar">
<h3>热门文章</h3>
<ul>
<li><a href="#">JavaScript异步编程详解</a></li>
<li><a href="#">React Hooks使用指南</a></li>
<li><a href="#">CSS Grid布局实战</a></li>
<li><a href="#">Git工作流最佳实践</a></li>
</ul>
</aside>
</div>
</div>
</main>
<!-- 页脚 -->
<footer>
<div class="container">
<p>© 2025 我的个人博客. 保留所有权利.</p>
<div class="social-links">
<a href="#">📧</a>
<a href="#">💼</a