个人主页代码html+css
时间: 2023-11-13 08:21:02 浏览: 33
<!DOCTYPE html>
<html>
<head>
<title>个人主页</title>
<style>
body {
font-family: Arial, sans-serif;
background-color: #f2f2f2;
}
header {
background-color: #333;
color: #fff;
padding: 20px;
text-align: center;
}
h1 {
margin: 0;
font-size: 36px;
}
nav {
background-color: #f2f2f2;
padding: 10px;
display: flex;
justify-content: space-between;
align-items: center;
}
nav ul {
margin: 0;
padding: 0;
list-style: none;
display: flex;
}
nav ul li {
margin-right: 20px;
}
nav ul li a {
color: #333;
text-decoration: none;
font-weight: bold;
font-size: 18px;
padding: 10px;
transition: background-color 0.3s ease;
}
nav ul li a:hover {
background-color: #333;
color: #fff;
}
section {
display: flex;
flex-wrap: wrap;
justify-content: space-around;
align-items: center;
padding: 20px;
}
article {
background-color: #fff;
border-radius: 5px;
box-shadow: 0 0 10px rgba(0,0,0,0.2);
margin: 20px;
padding: 20px;
width: 300px;
text-align: center;
}
article h2 {
font-size: 24px;
margin-top: 0;
}
article p {
font-size: 16px;
line-height: 1.5;
}
footer {
background-color: #333;
color: #fff;
padding: 20px;
text-align: center;
}
footer p {
margin: 0;
font-size: 18px;
}
</style>
</head>
<body>
<header>
<h1>个人主页</h1>
</header>
<nav>
<ul>
<li><a href="#">首页</a></li>
<li><a href="#">个人简介</a></li>
<li><a href="#">我的作品</a></li>
<li><a href="#">联系我</a></li>
</ul>
<form action="#" method="get">
<input type="search" name="search" id="search" placeholder="搜索">
<button type="submit">搜索</button>
</form>
</nav>
<section>
<article>
<h2>个人简介</h2>
<p>我是一名Web开发者,擅长使用HTML、CSS、JavaScript等技术来开发各种网站和应用程序。</p>
</article>
<article>
<h2>我的作品</h2>
<p>以下是我近期完成的一些作品。</p>
<ul>
<li><a href="#">作品1</a></li>
<li><a href="#">作品2</a></li>
<li><a href="#">作品3</a></li>
</ul>
</article>
<article>
<h2>联系我</h2>
<p>如果您有任何问题或建议,请随时联系我。</p>
<ul>
<li>Email: <a href="mailto:example@example.com">example@example.com</a></li>
<li>电话: 123-456-7890</li>
</ul>
</article>
</section>
<footer>
<p>版权所有 © 2021 个人主页</p>
</footer>
</body>
</html>