使用html css 写一个学生信息管理系统
时间: 2023-09-07 18:12:52 浏览: 57
好的,以下是一个简单的学生信息管理系统的HTML和CSS代码示例:
HTML代码:
```
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>学生信息管理系统</title>
<link rel="stylesheet" href="./style.css">
</head>
<body>
<h1>学生信息管理系统</h1>
<div class="container">
<form>
<label for="name">姓名:</label>
<input type="text" id="name" name="name" required>
<label for="age">年龄:</label>
<input type="number" id="age" name="age" required>
<label for="gender">性别:</label>
<select id="gender" name="gender" required>
<option value="">请选择</option>
<option value="male">男</option>
<option value="female">女</option>
</select>
<label for="student-id">学号:</label>
<input type="text" id="student-id" name="student-id" required>
<button type="submit">添加</button>
</form>
<table>
<thead>
<tr>
<th>姓名</th>
<th>年龄</th>
<th>性别</th>
<th>学号</th>
<th>操作</th>
</tr>
</thead>
<tbody>
<tr>
<td>张三</td>
<td>20</td>
<td>男</td>
<td>10001</td>
<td>
<button>编辑</button>
<button>删除</button>
</td>
</tr>
<tr>
<td>李四</td>
<td>21</td>
<td>女</td>
<td>10002</td>
<td>
<button>编辑</button>
<button>删除</button>
</td>
</tr>
</tbody>
</table>
</div>
</body>
</html>
```
CSS代码:
```
body {
font-size: 16px;
font-family: Arial, sans-serif;
background-color: #f2f2f2;
}
.container {
margin: 20px auto;
padding: 20px;
background-color: #fff;
border-radius: 5px;
box-shadow: 0px 0px 5px #999;
}
h1 {
text-align: center;
}
form {
display: flex;
flex-wrap: wrap;
align-items: center;
margin-bottom: 20px;
}
label {
flex-basis: 100px;
margin-right: 10px;
text-align: right;
}
input, select {
flex: 1;
padding: 5px;
border-radius: 3px;
border: 1px solid #ccc;
}
button {
padding: 5px 10px;
background-color: #4caf50;
color: #fff;
border: none;
border-radius: 3px;
cursor: pointer;
}
table {
width: 100%;
border-collapse: collapse;
}
thead th {
background-color: #4caf50;
color: #fff;
padding: 10px;
text-align: left;
}
tbody td {
padding: 10px;
border-bottom: 1px solid #ccc;
}
tbody td:last-child {
text-align: center;
}
tbody button {
margin-right: 5px;
padding: 5px 10px;
background-color: #4caf50;
color: #fff;
border: none;
border-radius: 3px;
cursor: pointer;
}
tbody button:last-child {
background-color: #f44336;
margin-right: 0;
}
```
这段代码实现了一个简单的学生信息管理系统,包括添加学生信息、展示学生列表、编辑和删除学生信息等功能。您可以根据您的实际需求进行修改和完善。