用css+html写一个房间信息表,表格分为两列左边一列为:楼层号、房间号、楼层、可住人数、已住人数。右边一列列暂时不填但需要保留空白,左列的底色设置为浅灰色,字体加粗,
时间: 2023-06-16 12:02:05 浏览: 54
可以参考以下代码实现房间信息表格:
```html
<!DOCTYPE html>
<html>
<head>
<title>房间信息表格</title>
<style>
table {
border-collapse: collapse;
width: 100%;
}
th, td {
padding: 8px;
text-align: left;
border-bottom: 1px solid #ddd;
}
th {
background-color: #f2f2f2;
font-weight: bold;
}
.left-column {
background-color: #f9f9f9;
font-weight: bold;
}
</style>
</head>
<body>
<table>
<tr>
<th class="left-column">楼层号</th>
<td></td>
</tr>
<tr>
<th class="left-column">房间号</th>
<td></td>
</tr>
<tr>
<th class="left-column">楼层</th>
<td></td>
</tr>
<tr>
<th class="left-column">可住人数</th>
<td></td>
</tr>
<tr>
<th class="left-column">已住人数</th>
<td></td>
</tr>
</table>
</body>
</html>
```
在代码中,我们使用了 `<table>` 标签来创建表格,设置了表格的边框合并和宽度为100%。在表格中,使用了 `<th>` 标签定义表格的表头,在 `<th>` 标签中加入 `left-column` 类来设置左列的底色为浅灰色和字体加粗。在 `<td>` 标签中填写对应的房间信息,右列暂时不填但保留空白。最后,使用 CSS 样式来设置表格的样式,包括表头和单元格的样式、左列的底色和字体加粗等。