使用html和css帮我写一个个人中心页面,有侧向导航包含登录注册功能
时间: 2023-06-12 07:06:33 浏览: 50
好的,以下是一个简单的个人中心页面,包含侧向导航和登录注册功能的HTML和CSS代码:
```html
<!DOCTYPE html>
<html>
<head>
<title>个人中心</title>
<style>
/* 设置页面样式 */
body {
margin: 0;
padding: 0;
font-family: Arial, sans-serif;
}
/* 设置侧向导航样式 */
nav {
background-color: #333;
color: #fff;
height: 100%;
position: fixed;
top: 0;
left: 0;
width: 200px;
padding: 20px;
box-sizing: border-box;
}
nav h1 {
margin: 0;
padding: 0;
font-size: 24px;
text-align: center;
}
nav ul {
margin: 0;
padding: 0;
list-style: none;
margin-top: 30px;
}
nav ul li {
margin-bottom: 10px;
}
nav ul li a {
color: #fff;
text-decoration: none;
display: block;
padding: 5px;
border-radius: 5px;
transition: background-color 0.3s ease;
}
nav ul li a:hover {
background-color: #555;
}
/* 设置主体内容样式 */
.main {
margin-left: 200px;
padding: 20px;
box-sizing: border-box;
}
/* 设置登录注册表单样式 */
.form {
display: flex;
flex-direction: column;
align-items: center;
margin-top: 50px;
}
.form label {
font-size: 18px;
margin-bottom: 10px;
}
.form input[type="text"],
.form input[type="password"] {
width: 100%;
padding: 10px;
margin-bottom: 20px;
border-radius: 5px;
border: none;
box-shadow: 0 0 5px #aaa;
box-sizing: border-box;
}
.form input[type="submit"] {
background-color: #333;
color: #fff;
padding: 10px 20px;
border: none;
border-radius: 5px;
font-size: 18px;
cursor: pointer;
transition: background-color 0.3s ease;
}
.form input[type="submit"]:hover {
background-color: #555;
}
</style>
</head>
<body>
<nav>
<h1>个人中心</h1>
<ul>
<li><a href="#">我的资料</a></li>
<li><a href="#">我的订单</a></li>
<li><a href="#">购物车</a></li>
<li><a href="#">联系客服</a></li>
<li><a href="#">退出登录</a></li>
</ul>
</nav>
<div class="main">
<h2>登录</h2>
<div class="form">
<label for="username">用户名</label>
<input type="text" id="username">
<label for="password">密码</label>
<input type="password" id="password">
<input type="submit" value="登录">
</div>
<h2>注册</h2>
<div class="form">
<label for="reg_username">用户名</label>
<input type="text" id="reg_username">
<label for="reg_password">密码</label>
<input type="password" id="reg_password">
<input type="submit" value="注册">
</div>
</div>
</body>
</html>
```
你可以将上述代码保存为 `.html` 文件并在浏览器中打开查看效果。