这个网页设计包含了以下几个核心部分,非常适合学生使用:

(图片来源网络,侵删)
- 导航栏:方便访问网站的不同部分。
- 个人简介:一个吸引人的“英雄”区域,展示你的照片、姓名和一句话介绍。
- 关于我:更详细地介绍你的背景、兴趣和目标。
- 技能展示:用进度条或图标直观地展示你的技能。
- 项目/作品集:展示你做过的课程项目、设计作品或编程练习。
- 教育背景:列出你的学校、专业和学历。
- 联系方式:提供多种方式让别人联系到你。
- 页脚:版权信息等。
最终效果预览
你可以想象一个这样的网页布局:
- 顶部是固定的导航栏,滚动时始终可见。
- 你的大照片、名字和一句“你好,我是...”。
- 向下滚动,是关于你的详细介绍。
- 然后是技能条,展示你的能力。
- 接着是项目卡片,展示你的作品。
- 之后是你的教育经历。
- 联系表单和社交媒体链接。
- 最底部是页脚。
如何使用
- 创建文件:在你的电脑上创建一个文件夹,
my-portfolio,在该文件夹中创建三个文件:index.htmlstyle.cssscript.js
- 复制代码:将下面提供的代码分别复制到对应的文件中。
- 个性化修改:这是最重要的一步! 将所有带有
[占位符]的内容替换成你自己的信息。 - 添加图片:将你的个人照片命名为
profile.jpg,并放在my-portfolio文件夹中,你也可以根据代码中的路径调整图片位置。 - 预览网页:用浏览器打开
index.html文件,你就可以看到你的个人网页了!
index.html 代码
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">[你的名字] - 学生个人主页</title>
<link rel="stylesheet" href="style.css">
<!-- 引入字体图标库 (Font Awesome) -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css">
</head>
<body>
<!-- 导航栏 -->
<nav class="navbar">
<a href="#home" class="nav-link">首页</a>
<a href="#about" class="nav-link">关于我</a>
<a href="#skills" class="nav-link">技能</a>
<a href="#projects" class="nav-link">项目</a>
<a href="#education" class="nav-link">教育</a>
<a href="#contact" class="nav-link">联系我</a>
</nav>
<main>
<!-- 个人简介 / Hero 区域 -->
<section id="home" class="hero">
<img src="profile.jpg" alt="[你的名字]的个人照片" class="profile-img">
<h1>[你的名字]</h1>
<p class="tagline">一名充满热情的 [你的专业,如:计算机科学] 学生</p>
<p class="intro">你好!我是一名来自 [你的学校] 的学生,热爱 [你的兴趣,如:编程、设计和解决问题],我致力于用技术创造有价值的作品。</p>
<a href="#contact" class="cta-button">联系我</a>
</section>
<!-- 关于我 -->
<section id="about" class="about">
<h2>关于我</h2>
<p>这里是详细介绍你的地方,你可以谈谈你的学习经历、你的热情所在、你的个人目标,以及是什么驱动着你成为一名优秀的学生,你可以分享一个你特别感兴趣的课程项目,或者一个你正在学习的新技术,让访问者感受到你的个性和潜力。</p>
<p>除了学习,我的兴趣爱好是 [阅读科幻小说、打篮球、摄影等],这些爱好帮助我保持创造力和健康的身心状态。</p>
</section>
<!-- 技能展示 -->
<section id="skills" class="skills">
<h2>我的技能</h2>
<div class="skill-container">
<div class="skill-item">
<span class="skill-name">HTML & CSS</span>
<div class="skill-bar">
<div class="skill-level" style="width: 90%;"></div>
</div>
</div>
<div class="skill-item">
<span class="skill-name">JavaScript</span>
<div class="skill-bar">
<div class="skill-level" style="width: 75%;"></div>
</div>
</div>
<div class="skill-item">
<span class="skill-name">Python</span>
<div class="skill-bar">
<div class="skill-level" style="width: 80%;"></div>
</div>
</div>
<div class="skill-item">
<span class="skill-name">UI/UX 设计</span>
<div class="skill-bar">
<div class="skill-level" style="width: 65%;"></div>
</div>
</div>
</div>
</section>
<!-- 项目作品集 -->
<section id="projects" class="projects">
<h2>我的项目</h2>
<div class="project-grid">
<div class="project-card">
<h3>项目名称 1</h3>
<p>这是一个项目的简短描述,解释这个项目是做什么的,你在其中扮演的角色,以及使用了什么技术,一个基于React的在线任务管理应用。</p>
<a href="#" class="project-link">查看详情 <i class="fas fa-arrow-right"></i></a>
</div>
<div class="project-card">
<h3>项目名称 2</h3>
<p>另一个项目的简短描述,一个使用Python和Pandas数据分析的电商销售趋势报告。</p>
<a href="#" class="project-link">查看详情 <i class="fas fa-arrow-right"></i></a>
</div>
<div class="project-card">
<h3>项目名称 3</h3>
<p>第三个项目的简短描述,一个关于校园生活的摄影系列作品集网站。</p>
<a href="#" class="project-link">查看详情 <i class="fas fa-arrow-right"></i></a>
</div>
</div>
</section>
<!-- 教育背景 -->
<section id="education" class="education">
<h2>教育背景</h2>
<div class="edu-item">
<h3>[你的大学名称]</h3>
<p class="degree">[你的专业,如:软件工程] - [你的学位,如:学士学位]</p>
<p class="date">[入学年份] - [毕业年份,或 预计毕业年份]</p>
<p>主修课程:[列举2-3门核心课程,如:数据结构、算法、操作系统]</p>
</div>
</section>
<!-- 联系方式 -->
<section id="contact" class="contact">
<h2>联系我</h2>
<p>如果你想与我合作、交流或只是打个招呼,欢迎通过以下方式联系我!</p>
<div class="contact-info">
<p><i class="fas fa-envelope"></i> your.email@example.com</p>
<p><i class="fab fa-github"></i> github.com/your-username</p>
<p><i class="fab fa-linkedin"></i> linkedin.com/in/your-username</p>
</div>
<form class="contact-form">
<input type="text" placeholder="你的名字" required>
<input type="email" placeholder="你的邮箱" required>
<textarea placeholder="你的留言" rows="5" required></textarea>
<button type="submit" class="submit-btn">发送消息</button>
</form>
</section>
</main>
<!-- 页脚 -->
<footer>
<p>© [年份] [你的名字]. 保留所有权利。</p>
</footer>
<script src="script.js"></script>
</body>
</html>
style.css 代码
/* --- 全局样式 --- */
:root {
--primary-color: #3498db; /* 主色调,可以修改 */
--secondary-color: #2c3e50; /* 次要颜色 */
--background-color: #f4f4f4;
--text-color: #333;
--light-gray: #ecf0f1;
--white: #ffffff;
}
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
line-height: 1.6;
background-color: var(--background-color);
color: var(--text-color);
}
h1, h2, h3 {
margin-bottom: 1rem;
color: var(--secondary-color);
}
section {
padding: 4rem 2rem;
max-width: 1100px;
margin: auto;
}
.container {
max-width: 1100px;
margin: auto;
overflow: hidden;
padding: 0 2rem;
}
/* --- 导航栏 --- */
.navbar {
display: flex;
justify-content: space-between;
align-items: center;
background: var(--white);
position: fixed; /* 固定在顶部 */
top: 0;
width: 100%;
z-index: 1000;
box-shadow: 0 2px 5px rgba(0,0,0,0.1);
padding: 1rem 2rem;
}
.navbar .nav-link {
color: var(--text-color);
text-decoration: none;
margin-left: 1.5rem;
font-weight: 600;
transition: color 0.3s ease;
}
.navbar .nav-link:hover {
color: var(--primary-color);
}
/* --- 个人简介 / Hero 区域 --- */
.hero {
text-align: center;
padding-top: 8rem; /* 为固定导航栏留出空间 */
background: linear-gradient(rgba(255, 255, 255, 0.7), rgba(255, 255, 255, 0.7)), url('https://images.unsplash.com/photo-1522252234503-e356532cafd5?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=1770&q=80') no-repeat center center/cover;
height: 100vh;
display: flex;
flex-direction: column;
justify-content: center;
}
.profile-img {
width: 200px;
height: 200px;
border-radius: 50%;
object-fit: cover;
border: 5px solid var(--white);
margin-bottom: 1.5rem;
box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}
.hero h1 {
font-size: 3rem;
margin-bottom: 0.5rem;
}
.tagline {
font-size: 1.5rem;
color: var(--primary-color);
margin-bottom: 1rem;
}
.cta-button {
display: inline-block;
background: var(--primary-color);
color: var(--white);
padding: 0.8rem 2rem;
text-decoration: none;
border-radius: 5px;
margin-top: 1rem;
transition: background 0.3s ease;
}
.cta-button:hover {
background: #2980b9;
}
/* --- 关于我 --- */
.about {
background: var(--white);
}
/* --- 技能展示 --- */
.skills {
text-align: center;
}
.skill-container {
max-width: 600px;
margin: 2rem auto;
text-align: left;
}
.skill-item {
margin-bottom: 1.5rem;
}
.skill-name {
display: block;
margin-bottom: 0.5rem;
font-weight: bold;
}
.skill-bar {
background: var(--light-gray);
height: 10px;
border-radius: 5px;
}
.skill-level {
height: 100%;
background: var(--primary-color);
border-radius: 5px;
width: 0; /* 初始为0,由JS动画填充 */
transition: width 1.5s ease-in-out;
}
/* --- 项目作品集 --- */
.projects {
background: var(--white);
}
.project-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
gap: 2rem;
}
.project-card {
background: var(--light-gray);
padding: 1.5rem;
border-radius: 8px;
box-shadow: 0 4px 8px rgba(0,0,0,0.1);
transition: transform 0.3s ease;
}
.project-card:hover {
transform: translateY(-10px);
}
.project-link {
display: inline-block;
color: var(--primary-color);
text-decoration: none;
font-weight: bold;
margin-top: 1rem;
}
/* --- 教育背景 --- */
.edu-item {
background: var(--white);
padding: 1.5rem;
border-radius: 8px;
box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}
.degree {
font-style: italic;
color: var(--primary-color);
}
.date {
font-size: 0.9rem;
color: #777;
}
/* --- 联系方式 --- */
.contact {
background: var(--white);
text-align: center;
}
.contact-info p {
margin: 0.5rem 0;
}
.contact-info i {
margin-right: 0.5rem;
color: var(--primary-color);
}
.contact-form {
max-width: 600px;
margin: 2rem auto 0;
display: flex;
flex-direction: column;
gap: 1rem;
}
.contact-form input,
.contact-form textarea {
width: 100%;
padding: 0.8rem;
border: 1px solid #ddd;
border-radius: 5px;
font-family: inherit;
}
.submit-btn {
background: var(--primary-color);
color: var(--white);
border: none;
padding: 0.8rem;
border-radius: 5px;
cursor: pointer;
font-size: 1rem;
transition: background 0.3s ease;
}
.submit-btn:hover {
background: #2980b9;
}
/* --- 页脚 --- */
footer {
text-align: center;
padding: 2rem;
background: var(--secondary-color);
color: var(--white);
}
/* --- 响应式设计 --- */
@media (max-width: 768px) {
.navbar {
flex-direction: column;
padding: 1rem;
}
.navbar .nav-link {
margin: 0.5rem 0;
}
.hero {
padding-top: 12rem;
}
.hero h1 {
font-size: 2rem;
}
section {
padding: 3rem 1rem;
}
}
script.js 代码
这个脚本主要实现两个功能:
- 平滑滚动:点击导航链接时,页面会平滑地滚动到对应部分,而不是跳转。
- 技能条动画:当滚动到“技能”部分时,技能进度条会从0开始填充,形成动画效果。
document.addEventListener('DOMContentLoaded', function() {
// 1. 平滑滚动功能
document.querySelectorAll('a[href^="#"]').forEach(anchor => {
anchor.addEventListener('click', function (e) {
e.preventDefault();
const targetId = this.getAttribute('href');
const targetSection = document.querySelector(targetId);
if (targetSection) {
// 滚动到目标元素,并考虑导航栏的高度
window.scrollTo({
top: targetSection.offsetTop - 70, // 70是导航栏的大致高度
behavior: 'smooth'
});
}
});
});
// 2. 技能条动画
const skillBars = document.querySelectorAll('.skill-level');
const skillsSection = document.getElementById('skills');
// 创建一个观察器实例
const observer = new IntersectionObserver((entries, observer) => {
entries.forEach(entry => {
// 如果技能部分进入视口
if (entry.isIntersecting) {
// 遍历所有技能条
skillBars.forEach(bar => {
// 获取CSS中设置的宽度
const width = bar.style.width;
// 先将宽度重置为0
bar.style.width = '0';
// 使用setTimeout确保重置生效后,再设置回原宽度,触发动画
setTimeout(() => {
bar.style.width = width;
}, 100);
});
// 动画执行一次后,停止观察该元素
observer.unobserve(entry.target);
}
});
}, {
threshold: 0.5 // 当50%的元素可见时触发
});
// 开始观察技能部分
if (skillsSection) {
observer.observe(skillsSection);
}
});
进一步优化的建议
- 添加交互性:为“发送消息”按钮添加功能,使其能将表单数据通过邮件发送给你(这需要后端支持,如使用Formspree或Netlify Forms等服务)。
- 项目详情页:为每个项目创建单独的HTML页面,并在项目卡片中添加链接。
- 更丰富的设计:使用CSS动画或更复杂的布局(如Flexbox和Grid)来创建更独特的视觉效果。
- 部署上线:将你的网站部署到GitHub Pages、Vercel或Netlify等免费平台上,这样别人就可以通过互联网访问你的个人主页了。
希望这个完整的代码能帮助你制作出属于自己的精彩个人网页!祝你成功!

(图片来源网络,侵删)
