用html代码写一个个人网站
时间: 2023-09-30 11:05:37 浏览: 48
很高兴能为您提供帮助!以下是一个简单的个人网站的 HTML 代码示例,您可以根据自己的需要进行修改和定制:
```html
<!DOCTYPE html>
<html>
<head>
<title>我的个人网站</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="style.css">
</head>
<body>
<header>
<nav>
<ul>
<li><a href="#about">关于我</a></li>
<li><a href="#resume">我的简历</a></li>
<li><a href="#portfolio">我的作品</a></li>
<li><a href="#contact">联系我</a></li>
</ul>
</nav>
<h1>欢迎来到我的个人网站</h1>
</header>
<main>
<section id="about">
<h2>关于我</h2>
<p>我是一个热爱编程和设计的人,喜欢探索新技术和挑战自己。</p>
</section>
<section id="resume">
<h2>我的简历</h2>
<p>教育背景、工作经历、技能列表等</p>
</section>
<section id="portfolio">
<h2>我的作品</h2>
<ul>
<li><a href="#">作品1</a></li>
<li><a href="#">作品2</a></li>
<li><a href="#">作品3</a></li>
</ul>
</section>
<section id="contact">
<h2>联系我</h2>
<form action="#">
<label for="name">姓名:</label>
<input type="text" id="name" name="name"><br>
<label for="email">邮箱:</label>
<input type="email" id="email" name="email"><br>
<label for="message">留言:</label>
<textarea id="message" name="message"></textarea><br>
<input type="submit" value="发送">
</form>
</section>
</main>
<footer>
<p>版权所有 © 2021 我的个人网站</p>
</footer>
</body>
</html>
```
可以通过添加样式来美化页面,以下是一个示例 CSS 文件:
```css
* {
box-sizing: border-box;
margin: 0;
padding: 0;
}
header {
background-color: #333;
color: #fff;
padding: 20px;
text-align: center;
}
nav ul {
list-style: none;
margin: 0;
padding: 0;
}
nav li {
display: inline-block;
margin: 0 10px;
}
nav a {
color: #fff;
text-decoration: none;
}
main {
margin: 20px;
}
section {
margin-bottom: 30px;
}
h2 {
margin-bottom: 10px;
}
ul {
list-style: none;
margin: 0;
padding: 0;
}
li {
margin-bottom: 10px;
}
form label {
display: block;
}
form input, form textarea {
margin-bottom: 10px;
padding: 5px;
}
form input[type="submit"] {
background-color: #333;
border: none;
color: #fff;
cursor: pointer;
padding: 10px 20px;
}
footer {
background-color: #eee;
padding: 10px;
text-align: center;
}
```
希望这个示例代码可以帮助到您!