<!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;
}
.container {
padding: 20px;
}
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="#about">关于我</a>
<a href="#projects">项目</a>
<a href="#contact">联系我</a>
</nav>
<div class="container">
<section id="about">
<h2>关于我</h2>
<p>这里是关于我的介绍。</p>
</section>
<section id="projects">
<h2>项目</h2>
<p>这里是我的一些项目。</p>
</section>
<section id="contact">
<h2>联系我</h2>
<p>可以通过以下方式联系我:email@example.com</p>
</section>
</div>
<footer>
<p>© 2023 我的名字</p>
</footer>
</body>
</html>
HTML结构:
<!DOCTYPE html>:声明文档类型为HTML5。<html lang="zh-CN">:指定网页语言为中文。<head>:包含元数据、标题和样式信息。<body>:包含页面的主要内容。头部 (<header>) 和导航栏 (<nav>)
flexbox布局,使其居中显示。主要内容区 (<div class="container">)
<section>标签包裹,并通过ID进行锚点链接。页脚 (<footer>)
这个示例代码提供了一个简单的个人主页模板,可以根据需要进一步扩展和修改。
上一篇:html表格边框
下一篇:html常用的标签有哪些
Laravel PHP 深圳智简公司。版权所有©2023-2043 LaravelPHP 粤ICP备2021048745号-3
Laravel 中文站