<!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>
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
background-color: #f4f4f4;
}
header {
background-color: #4CAF50;
color: white;
padding: 10px 0;
text-align: center;
}
nav {
display: flex;
justify-content: center;
background-color: #333;
}
nav a {
color: white;
padding: 14px 20px;
text-decoration: none;
text-align: center;
}
nav a:hover {
background-color: #ddd;
color: black;
}
section {
padding: 20px;
margin: 20px;
background-color: white;
}
footer {
background-color: #333;
color: white;
text-align: center;
padding: 10px 0;
position: fixed;
bottom: 0;
width: 100%;
}
</style>
</head>
<body>
<header>
<h1>欢迎来到我的个人网页</h1>
</header>
<nav>
<a href="#home">首页</a>
<a href="#about">关于我</a>
<a href="#projects">项目</a>
<a href="#contact">联系我</a>
</nav>
<section id="home">
<h2>首页</h2>
<p>这是我的个人网页的首页,欢迎访问!</p>
</section>
<section id="about">
<h2>关于我</h2>
<p>这里可以介绍一下自己。</p>
</section>
<section id="projects">
<h2>项目</h2>
<p>这里可以列出一些自己的项目。</p>
</section>
<section id="contact">
<h2>联系我</h2>
<p>可以通过以下方式联系我:</p>
<ul>
<li>Email: example@example.com</li>
<li>电话: 123-456-7890</li>
</ul>
</section>
<footer>
<p>© 2023 我的名字. 版权所有.</p>
</footer>
</body>
</html>
HTML 结构:
<!DOCTYPE html>:声明文档类型为 HTML5。<html lang="zh-CN">:指定文档的语言为简体中文。<head>:包含页面的元数据(如字符集、视口设置、标题和样式)。<body>:包含页面的主要内容。头部 (<header>) 和导航栏 (<nav>)
主体部分 (<section>)
id 属性与导航栏中的 href 链接对应,实现点击导航时跳转到相应部分。页脚 (<footer>)
CSS 样式
:hover 伪类为导航栏链接添加鼠标悬停效果。上一篇:html简单网页成品
下一篇:html在线生成
Laravel PHP 深圳智简公司。版权所有©2023-2043 LaravelPHP 粤ICP备2021048745号-3
Laravel 中文站