帮我用html+css制作一个精美的table表格要求表格简约大方贴合管理员管理
时间: 2024-03-27 21:35:09 浏览: 26
好的,以下是一个简单的示例代码:
HTML:
```html
<table>
<thead>
<tr>
<th>编号</th>
<th>用户名</th>
<th>邮箱</th>
<th>加入时间</th>
<th>操作</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td>张三</td>
<td>zhangsan@example.com</td>
<td>2021-01-01</td>
<td>
<button>编辑</button>
<button>删除</button>
</td>
</tr>
<tr>
<td>2</td>
<td>李四</td>
<td>lisi@example.com</td>
<td>2021-02-01</td>
<td>
<button>编辑</button>
<button>删除</button>
</td>
</tr>
<tr>
<td>3</td>
<td>王五</td>
<td>wangwu@example.com</td>
<td>2021-03-01</td>
<td>
<button>编辑</button>
<button>删除</button>
</td>
</tr>
</tbody>
</table>
```
CSS:
```css
table {
border-collapse: collapse;
width: 100%;
max-width: 800px;
margin: 0 auto;
}
thead th {
background-color: #f2f2f2;
color: #333;
font-weight: normal;
padding: 10px;
text-align: left;
border-bottom: 2px solid #ddd;
}
tbody td {
padding: 10px;
border-bottom: 1px solid #ddd;
}
tbody td:first-child {
font-weight: bold;
}
tbody td:last-child {
text-align: right;
}
button {
background-color: #333;
color: #fff;
border: none;
padding: 5px 10px;
border-radius: 5px;
cursor: pointer;
margin-left: 10px;
}
button:hover {
background-color: #666;
}
```
这个表格有一个简约的样式,包括表头和表格主体,每行显示用户的信息,包括编号、用户名、邮箱和加入时间,每行最后一个单元格包括"编辑"和"删除"按钮。表头的背景色是淡灰色,文字颜色是黑色,表格主体的每一行之间有一条细线分隔,最后一列的"编辑"和"删除"按钮的背景色是深灰色,当鼠标悬停在按钮上时,它们的背景色会变成淡灰色。
相关推荐
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![7z](https://img-home.csdnimg.cn/images/20210720083312.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)