您可以直接复制下面的所有代码,保存为一个 .html 文件(index.html),然后用浏览器打开即可看到效果。

个人网站网页设计模板html
(图片来源网络,侵删)

个人网站网页设计模板 (HTML + CSS + JavaScript)

这个模板包含以下几个部分:

  1. 导航栏:固定在顶部,包含网站Logo和主导航链接,并支持暗黑模式切换。
  2. 主页横幅:展示您的姓名、职业和一句简短的介绍。
  3. 关于我:用图文结合的方式介绍您的背景、技能和热情。
  4. 技能/专长:以进度条或图标的形式展示您的核心技能。
  5. 项目展示:网格布局展示您的项目,每个项目包含图片、标题、简短描述和技术栈。
  6. 联系方式:提供多种联系方式(邮箱、社交媒体等)。
  7. 页脚:版权信息。

第一步:完整代码 (直接复制使用)

<!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="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
    <style>
        /* --- 全局样式和变量 --- */
        :root {
            --bg-color: #ffffff;
            --text-color: #333333;
            --secondary-color: #f4f4f4;
            --accent-color: #007bff;
            --card-bg-color: #ffffff;
            --nav-bg-color: rgba(255, 255, 255, 0.95);
            --border-color: #dddddd;
        }
        [data-theme="dark"] {
            --bg-color: #1a1a1a;
            --text-color: #e0e0e0;
            --secondary-color: #2d2d2d;
            --accent-color: #4dabf7;
            --card-bg-color: #2d2d2d;
            --nav-bg-color: rgba(26, 26, 26, 0.95);
            --border-color: #444444;
        }
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }
        body {
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
            line-height: 1.6;
            color: var(--text-color);
            background-color: var(--bg-color);
            transition: background-color 0.3s ease, color 0.3s ease;
        }
        html {
            scroll-behavior: smooth;
        }
        .container {
            max-width: 1100px;
            margin: auto;
            padding: 0 2rem;
            overflow: hidden;
        }
        h1, h2, h3 {
            font-weight: 600;
            line-height: 1.2;
        }
        h1 { font-size: 2.5rem; }
        h2 { font-size: 2rem; margin-bottom: 1rem; }
        h3 { font-size: 1.3rem; }
        a {
            color: var(--accent-color);
            text-decoration: none;
            transition: color 0.3s ease;
        }
        a:hover {
            color: #0056b3;
        }
        section {
            padding: 4rem 0;
        }
        .section-title {
            text-align: center;
            margin-bottom: 3rem;
            position: relative;
        }
        .section-title::after {
            content: '';
            display: block;
            width: 50px;
            height: 3px;
            background: var(--accent-color);
            margin: 1rem auto;
        }
        /* --- 导航栏 --- */
        #main-nav {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 1rem 2rem;
            background-color: var(--nav-bg-color);
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            z-index: 1000;
            box-shadow: 0 2px 10px rgba(0,0,0,0.1);
            transition: background-color 0.3s ease;
        }
        .logo {
            font-size: 1.5rem;
            font-weight: 700;
            color: var(--accent-color);
        }
        .nav-links {
            display: flex;
            list-style: none;
        }
        .nav-links li {
            margin-left: 2rem;
        }
        .nav-links a {
            color: var(--text-color);
            font-weight: 500;
        }
        .theme-switcher {
            background: none;
            border: none;
            color: var(--text-color);
            font-size: 1.5rem;
            cursor: pointer;
        }
        /* --- 主页横幅 --- */
        #home {
            height: 100vh;
            display: flex;
            align-items: center;
            justify-content: center;
            text-align: center;
            background: linear-gradient(rgba(0,0,0,0.6), rgba(0,0,0,0.6)), url('https://images.unsplash.com/photo-1557682257-2f9c37a3a5f3?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=1740&q=80') no-repeat center center/cover;
            color: #ffffff;
        }
        .home-content h1 {
            font-size: 3.5rem;
            margin-bottom: 1rem;
        }
        .home-content .subtitle {
            font-size: 1.5rem;
            margin-bottom: 2rem;
        }
        .btn {
            display: inline-block;
            padding: 0.8rem 2rem;
            background: var(--accent-color);
            color: #ffffff;
            border: none;
            border-radius: 5px;
            cursor: pointer;
            font-size: 1rem;
            font-weight: 600;
            transition: background 0.3s ease, transform 0.3s ease;
        }
        .btn:hover {
            background: #0056b3;
            transform: translateY(-3px);
        }
        /* --- 关于我 --- */
        #about {
            background-color: var(--secondary-color);
        }
        .about-content {
            display: grid;
            grid-template-columns: 1fr 2fr;
            gap: 3rem;
            align-items: center;
        }
        .about-img {
            width: 250px;
            height: 250px;
            border-radius: 50%;
            object-fit: cover;
            border: 5px solid var(--accent-color);
        }
        .about-text p {
            margin-bottom: 1rem;
        }
        /* --- 技能 --- */
        .skills-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
            gap: 2rem;
        }
        .skill-item {
            background: var(--card-bg-color);
            padding: 1.5rem;
            border-radius: 8px;
            box-shadow: 0 5px 15px rgba(0,0,0,0.1);
            transition: transform 0.3s ease;
        }
        .skill-item:hover {
            transform: translateY(-10px);
        }
        .skill-item i {
            font-size: 2.5rem;
            color: var(--accent-color);
            margin-bottom: 1rem;
        }
        /* --- 项目 --- */
        .projects-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
            gap: 2rem;
        }
        .project-card {
            background: var(--card-bg-color);
            border-radius: 8px;
            overflow: hidden;
            box-shadow: 0 5px 15px rgba(0,0,0,0.1);
            transition: transform 0.3s ease;
        }
        .project-card:hover {
            transform: translateY(-10px);
        }
        .project-img {
            width: 100%;
            height: 200px;
            object-fit: cover;
        }
        .project-info {
            padding: 1.5rem;
        }
        .project-info h3 {
            margin-bottom: 0.5rem;
        }
        .project-tags {
            margin-top: 1rem;
        }
        .tag {
            display: inline-block;
            background: var(--secondary-color);
            color: var(--text-color);
            padding: 0.3rem 0.8rem;
            border-radius: 20px;
            font-size: 0.8rem;
            margin-right: 0.5rem;
        }
        /* --- 联系方式 --- */
        #contact {
            background-color: var(--secondary-color);
            text-align: center;
        }
        .contact-links {
            display: flex;
            justify-content: center;
            gap: 2rem;
            margin-top: 2rem;
        }
        .contact-links a {
            display: flex;
            align-items: center;
            justify-content: center;
            width: 60px;
            height: 60px;
            background: var(--card-bg-color);
            color: var(--text-color);
            border-radius: 50%;
            font-size: 1.5rem;
            transition: background 0.3s ease, color 0.3s ease;
        }
        .contact-links a:hover {
            background: var(--accent-color);
            color: #ffffff;
        }
        /* --- 页脚 --- */
        #main-footer {
            text-align: center;
            padding: 1.5rem 0;
            background-color: var(--card-bg-color);
            border-top: 1px solid var(--border-color);
        }
        /* --- 响应式设计 --- */
        @media (max-width: 768px) {
            .nav-links, .theme-switcher {
                display: none; /* 简单处理,实际可用汉堡菜单 */
            }
            .home-content h1 {
                font-size: 2.5rem;
            }
            .about-content {
                grid-template-columns: 1fr;
                text-align: center;
            }
            .about-img {
                margin: 0 auto;
            }
            .contact-links {
                flex-wrap: wrap;
            }
        }
    </style>
</head>
<body>
    <!-- 导航栏 -->
    <nav id="main-nav">
        <div class="container">
            <a href="#home" class="logo">张三</a>
            <ul class="nav-links">
                <li><a href="#home">首页</a></li>
                <li><a href="#about">关于我</a></li>
                <li><a href="#skills">技能</a></li>
                <li><a href="#projects">项目</a></li>
                <li><a href="#contact">联系我</a></li>
            </ul>
            <button class="theme-switcher" id="theme-switcher">
                <i class="fas fa-moon"></i>
            </button>
        </div>
    </nav>
    <!-- 主页横幅 -->
    <header id="home">
        <div class="home-content">
            <h1>你好,我是张三</h1>
            <p class="subtitle">一名充满激情的全栈开发工程师</p>
            <a href="#projects" class="btn">查看我的作品</a>
        </div>
    </header>
    <!-- 关于我 -->
    <section id="about">
        <div class="container">
            <h2 class="section-title">关于我</h2>
            <div class="about-content">
                <img src="https://i.pravatar.cc/150?u=zhangsan" alt="张三的头像" class="about-img">
                <div class="about-text">
                    <p>我是一名拥有5年经验的全栈开发工程师,专注于构建高性能、用户友好的Web应用程序,我热衷于学习新技术,并将其应用到实际项目中,以解决复杂问题。</p>
                    <p>在我的职业生涯中,我曾参与过多个大型项目的开发,从前端UI/UX设计到后端架构搭建,再到数据库优化,积累了丰富的实战经验。</p>
                    <p>我相信,优秀的代码不仅要功能强大,更要易于维护和扩展,我致力于编写清晰、简洁、高效的代码。</p>
                </div>
            </div>
        </div>
    </section>
    <!-- 技能 -->
    <section id="skills">
        <div class="container">
            <h2 class="section-title">我的技能</h2>
            <div class="skills-grid">
                <div class="skill-item">
                    <i class="fab fa-html5"></i>
                    <h3>前端开发</h3>
                    <p>精通 HTML5, CSS3, JavaScript (ES6+), 以及 React, Vue 等现代前端框架。</p>
                </div>
                <div class="skill-item">
                    <i class="fas fa-server"></i>
                    <h3>后端开发</h3>
                    <p>熟练使用 Node.js, Python (Django/Flask), Java (Spring Boot) 进行服务端开发。</p>
                </div>
                <div class="skill-item">
                    <i class="fas fa-database"></i>
                    <h3>数据库</h3>
                    <p>熟悉 MySQL, PostgreSQL, MongoDB 等关系型和非关系型数据库的设计与优化。</p>
                </div>
                <div class="skill-item">
                    <i class="fab fa-aws"></i>
                    <h3>云服务 & DevOps</h3>
                    <p>有 AWS, Docker, CI/CD 相关经验,了解自动化部署和运维流程。</p>
                </div>
            </div>
        </div>
    </section>
    <!-- 项目展示 -->
    <section id="projects">
        <div class="container">
            <h2 class="section-title">项目展示</h2>
            <div class="projects-grid">
                <div class="project-card">
                    <img src="https://images.unsplash.com/photo-1551288049-bebda4e38f71?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=1170&q=80" alt="电商平台项目" class="project-img">
                    <div class="project-info">
                        <h3>现代电商平台</h3>
                        <p>一个功能完整的B2C电商平台,包含商品浏览、购物车、订单管理、支付集成等核心功能。</p>
                        <div class="project-tags">
                            <span class="tag">React</span>
                            <span class="tag">Node.js</span>
                            <span class="tag">MongoDB</span>
                            <span class="tag">Stripe</span>
                        </div>
                    </div>
                </div>
                <div class="project-card">
                    <img src="https://images.unsplash.com/photo-1551434678-e076c223a692?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=1170&q=80" alt="任务管理应用" class="project-img">
                    <div class="project-info">
                        <h3>团队任务管理工具</h3>
                        <p>一个支持实时协作的任务管理应用,帮助团队高效地跟踪项目进度和分配任务。</p>
                        <div class="project-tags">
                            <span class="tag">Vue.js</span>
                            <span class="tag">Express</span>
                            <span class="tag">PostgreSQL</span>
                            <span class="tag">Socket.io</span>
                        </div>
                    </div>
                </div>
                <div class="project-card">
                    <img src="https://images.unsplash.com/photo-1555066931-4365d14bab8c?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=1170&q=80" alt="数据可视化面板" class="project-img">
                    <div class="project-info">
                        <h3>数据可视化仪表盘</h3>
                        <p>为企业打造的数据分析平台,通过图表和报表直观展示关键业务指标。</p>
                        <div class="project-tags">
                            <span class="tag">Angular</span>
                            <span class="tag">Python</span>
                            <span class="tag">D3.js</span>
                            <span class="tag">Redis</span>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </section>
    <!-- 联系方式 -->
    <section id="contact">
        <div class="container">
            <h2 class="section-title">联系我</h2>
            <p>如果您对我的工作感兴趣,或者有任何问题,欢迎随时与我联系!</p>
            <div class="contact-links">
                <a href="mailto:your.email@example.com" title="Email"><i class="fas fa-envelope"></i></a>
                <a href="https://github.com/yourusername" title="GitHub" target="_blank"><i class="fab fa-github"></i></a>
                <a href="https://linkedin.com/in/yourusername" title="LinkedIn" target="_blank"><i class="fab fa-linkedin"></i></a>
                <a href="https://twitter.com/yourusername" title="Twitter" target="_blank"><i class="fab fa-twitter"></i></a>
            </div>
        </div>
    </section>
    <!-- 页脚 -->
    <footer id="main-footer">
        <div class="container">
            <p>&copy; 2025 张三. 保留所有权利.</p>
        </div>
    </footer>
    <script>
        // 暗黑模式切换功能
        const themeSwitcher = document.getElementById('theme-switcher');
        const body = document.body;
        const icon = themeSwitcher.querySelector('i');
        // 检查本地存储中的主题设置
        const currentTheme = localStorage.getItem('theme') || 'light';
        body.setAttribute('data-theme', currentTheme);
        updateThemeIcon(currentTheme);
        themeSwitcher.addEventListener('click', () => {
            const currentTheme = body.getAttribute('data-theme');
            const newTheme = currentTheme === 'light' ? 'dark' : 'light';
            body.setAttribute('data-theme', newTheme);
            localStorage.setItem('theme', newTheme);
            updateThemeIcon(newTheme);
        });
        function updateThemeIcon(theme) {
            if (theme === 'dark') {
                icon.classList.remove('fa-moon');
                icon.classList.add('fa-sun');
            } else {
                icon.classList.remove('fa-sun');
                icon.classList.add('fa-moon');
            }
        }
        // 导航栏滚动效果
        const nav = document.getElementById('main-nav');
        window.addEventListener('scroll', () => {
            if (window.scrollY > 100) {
                nav.style.backgroundColor = 'rgba(0, 0, 0, 0.9)'; // 深色背景
            } else {
                // 恢复原始背景色,根据主题变化
                const currentTheme = body.getAttribute('data-theme');
                nav.style.backgroundColor = currentTheme === 'dark' ? 'rgba(26, 26, 26, 0.95)' : 'rgba(255, 255, 255, 0.95)';
            }
        });
    </script>
</body>
</html>

第二步:如何使用和自定义

  1. 保存文件:将上面的所有代码复制到一个新的文本文件中,并将其命名为 index.html
  2. 打开预览:用任何现代浏览器(如 Chrome, Firefox, Edge)打开这个 index.html 文件,你就能看到一个完整的个人网站。
  3. :这是最重要的一步,你需要将模板中的占位信息替换成你自己的信息。
    • 标题和姓名:修改 <title> 标签和导航栏、主页横幅中的“张三”。
    • 个人信息:在“关于我”部分,替换掉关于张三的介绍文字。
    • 头像:替换 <img src="https://i.pravatar.cc/150?u=zhangsan"> 中的 src 属性为你自己的头像图片链接。
    • 技能:在“我的技能”部分,修改技能名称和描述。
    • 项目:这是展示你能力的核心。
      • 替换 <img src="..."> 中的链接为你自己项目的截图。
      • 修改 <h3> 中的项目标题。
      • 修改 <p> 中的项目描述。
      • 修改 <span class="tag"> 中的技术栈标签。
    • 联系方式:修改 <a href="mailto:..."> 中的邮箱地址,以及各个社交媒体链接中的 href 属性(yourusername 部分替换成你的真实用户名)。
  4. 图片资源
    • 模板中使用了 unsplash.com 上的随机图片作为背景和项目图,你可以直接使用,但为了更好的品牌一致性,建议替换成你自己的图片。
    • 你可以将图片和 index.html 文件放在同一个文件夹下,然后使用相对路径引用,<img src="my-photo.jpg">

第三步:进阶建议

当你熟悉了这个模板后,可以考虑进行以下优化和扩展:

  1. 添加动画效果:可以使用 AOS (Animate On Scroll) 库为各个部分添加滚动时的淡入、滑入等动画,让网站更生动。
  2. 完善响应式设计:为移动设备添加一个“汉堡菜单”来替代隐藏的导航链接。
  3. 添加博客模块:可以创建一个 blog.html 页面,使用静态网站生成器(如 Hexo, Hugo)或动态技术(如 React)来展示你的文章。
  4. 集成表单:在“联系我”部分添加一个联系表单,并将表单数据发送到你的邮箱或后端服务器。
  5. 性能优化:压缩图片、合并CSS/JS文件,以提高网站的加载速度。
  6. 部署上线:将你的网站部署到 GitHub Pages、Vercel、Netlify 等免费平台上,让其他人也能访问。

这个模板为你提供了一个坚实的基础,你可以根据自己的需求和创意进行无限的修改和扩展,祝你搭建顺利!

个人网站网页设计模板html
(图片来源网络,侵删)