明白了!我帮你把这个个人博客的布局和风格调整得更接近苹果官网的简洁、优雅和现代感。苹果官网的特点是:
- 大量留白,极简设计
- 大字体标题,清晰分区
- 统一的字体和色调(白底黑字,蓝色点缀)
- 细腻的阴影和圆角
- 响应式且内容居中
- 顶部导航简洁,带下划线悬停效果
- 文章区块整齐排列,带大图(这里用占位图)
下面是改进后的代码:
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>我的个人博客 - 仿苹果官网风格</title>
<style>
/* Reset */
*, *::before, *::after {
box-sizing: border-box;
}
body {
margin: 0;
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen,
Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
background: #fff;
color: #1d1d1f;
line-height: 1.5;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
a {
color: #0071e3;
text-decoration: none;
cursor: pointer;
}
a:hover {
text-decoration: underline;
}
/* Container */
.container {
max-width: 980px;
margin: 0 auto;
padding: 0 24px;
}
/* Header */
header {
position: fixed;
top: 0;
width: 100%;
background: #fff;
border-bottom: 1px solid #d2d2d7;
z-index: 1000;
}
nav {
display: flex;
justify-content: space-between;
align-items: center;
height: 48px;
max-width: 980px;
margin: 0 auto;
padding: 0 24px;
}
.logo {
font-weight: 600;
font-size: 20px;
color: #1d1d1f;
letter-spacing: -0.02em;
}
nav ul {
list-style: none;
display: flex;
gap: 32px;
}
nav ul li {
font-weight: 500;
font-size: 15px;
line-height: 1.2;
padding: 8px 0;
position: relative;
}
nav ul li a {
color: #1d1d1f;
padding-bottom: 4px;
display: inline-block;
}
nav ul li a:hover,
nav ul li a.active {
border-bottom: 2px solid #0071e3;
}
/* Main */
main {
padding-top: 72px;
}
/* Hero Section */
.hero {
text-align: center;
padding: 96px 24px 64px;
}
.hero h1 {
font-weight: 700;
font-size: 56px;
line-height: 1.1;
margin-bottom: 16px;
letter-spacing: -0.02em;
}
.hero p {
font-weight: 400;
font-size: 20px;
color: #6e6e73;
max-width: 600px;
margin: 0 auto;
}
/* Blog Posts Grid */
.blog-posts {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
gap: 48px;
padding-bottom: 96px;
}
/* Single Post */
article.blog-post {
border-radius: 20px;
box-shadow: 0 8px 24px rgb(0 0 0 / 0.1);
overflow: hidden;
background: #fff;
display: flex;
flex-direction: column;
transition: box-shadow 0.3s ease;
}
article.blog-post:hover {
box-shadow: 0 12px 40px rgb(0 0 0 / 0.15);
}
.post-image {
width: 100%;
height: 180px;
object-fit: cover;
background: #f5f5f7;
}
.post-content {
padding: 24px;
flex-grow: 1;
display: flex;
flex-direction: column;
}
.post-title {
font-weight: 600;
font-size: 24px;
margin-bottom: 8px;
color: #1d1d1f;
}
.post-meta {
font-size: 13px;
color: #6e6e73;
margin-bottom: 16px;
}
.post-excerpt {
font-size: 17px;
color: #3c3c4399;
flex-grow: 1;
margin-bottom: 24px;
}
.read-more {
font-weight: 600;
font-size: 15px;
color: #0071e3;
align-self: flex-start;
}
.read-more:hover {
text-decoration: underline;
}
/* Footer */
footer {
border-top: 1px solid #d2d2d7;
padding: 48px 24px;
text-align: center;
font-size: 14px;
color: #6e6e73;
}
/* Responsive */
@media (max-width: 600px) {
.hero h1 {
font-size: 36px;
}
.blog-posts {
gap: 32px;
}
}
</style>
</head>
<body>
<header>
<nav>
<div class="logo">我的博客</div>
<ul>
<li><a href="#home" class="active">首页</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" id="home">
<h1>欢迎来到我的个人博客</h1>
<p>分享技术、生活和思考,记录成长的点点滴滴</p>
</section>
<section class="container blog-posts" id="blog">
<article class="blog-post">
<img class="post-image" src="https://via.placeholder.com/600x360?text=人工智能" alt="人工智能" />
<div class="post-content">
<h2 class="post-title">探索人工智能的未来</h2>
<div class="post-meta">2025年5月25日 | 技术分享</div>
<p class="post-excerpt">人工智能正在改变我们的生活方式。从智能助手到自动驾驶,AI技术的应用越来越广泛。本文将探讨AI技术的最新进展和未来发展趋势...</p>
<a href="#" class="read-more">阅读更多 →</a>
</div>
</article>
<article class="blog-post">
<img class="post-image" src="https://via.placeholder.com/600x360?text=Web开发" alt="Web开发" />
<div class="post-content">
<h2 class="post-title">Web开发最佳实践</h2>
<div class="post-meta">2025年5月20日 | 编程心得</div>
<p class="post-excerpt">在现代Web开发中,性能优化和用户体验是两个关键因素。本文将分享一些实用的开发技巧,帮助你构建更快、更好的网站...</p>
<a href="#" class="read-more">阅读更多 →</a>
</div>
</article>
<article class="blog-post">
<img class="post-image" src="https://via.placeholder.com/600x360?text=远程工作" alt="远程工作" />
<div class="post-content">
<h2 class="post-title">远程工作的挑战与机遇</h2>
<div class="post-meta">2025年5月15日 | 生活感悟</div>
<p class="post-excerpt">远程工作已经成为新常态。如何在家中保持高效率?如何平衡工作与生活?这篇文章分享了我的一些经验和思考...</p>
<a href="#" class="read-more">阅读更多 →</a>
</div>
</article>
</section>
</main>
<footer>
© 2025 我的个人博客. 保留所有权利.
</footer>
<script>
// 平滑滚动
document.querySelectorAll('a[href^="#"]').forEach(anchor => {
anchor.addEventListener("click", e => {
e.preventDefault();
const target = document.querySelector(anchor.getAttribute("href"));
if (target) {
target.scrollIntoView({ behavior: "smooth", block: "start" });
}
});
});
</script>
</body>
</html>
说明:
- 导航栏固定在顶部,简洁无多余装饰,鼠标悬停和当前页面链接带蓝色下划线。
- 大标题和副标题居中,字体大且清晰。
- 博客文章用卡片式设计,带大图,圆角和阴影,悬停时阴影加深。
- 整体配色以白底黑字为主,蓝色作为强调色,符合苹果官网风格。
- 响应式设计,手机端自动调整布局和字体大小。
- 留白充足,让内容更突出,视觉更舒适。
你可以直接保存为 .html 文件打开查看效果,或者根据需要替换图片和内容。如果需要我帮你加更多苹果官网风格的细节(比如动画、字体微调、更多交互),随时告诉我!