html表格样式模板
时间: 2023-07-01 10:12:02 浏览: 88
以下是一个基本的HTML表格样式模板:
```html
<style>
table {
border-collapse: collapse;
width: 100%;
}
th, td {
text-align: left;
padding: 8px;
}
th {
background-color: #f2f2f2;
}
tr:nth-child(even) {
background-color: #f2f2f2;
}
tr:hover {
background-color: #ddd;
}
</style>
<table>
<tr>
<th>列1</th>
<th>列2</th>
<th>列3</th>
</tr>
<tr>
<td>行1列1</td>
<td>行1列2</td>
<td>行1列3</td>
</tr>
<tr>
<td>行2列1</td>
<td>行2列2</td>
<td>行2列3</td>
</tr>
</table>
```
这个模板包括了一些基本的表格样式,包括边框合并、单元格内边距、交替行背景色、鼠标悬停行背景色等。您可以根据您的需求自定义样式。
相关问题
好看的html表格模板
以下是一个简单却漂亮的 HTML 表格模板:
```html
<table>
<thead>
<tr>
<th>姓名</th>
<th>年龄</th>
<th>性别</th>
</tr>
</thead>
<tbody>
<tr>
<td>张三</td>
<td>25</td>
<td>男</td>
</tr>
<tr>
<td>李四</td>
<td>32</td>
<td>女</td>
</tr>
<tr>
<td>王五</td>
<td>19</td>
<td>男</td>
</tr>
</tbody>
</table>
```
你可以使用 CSS 样式来美化这个表格,例如:
```css
table {
border-collapse: collapse;
width: 100%;
max-width: 800px;
margin: 0 auto;
font-family: Arial, sans-serif;
}
thead {
background-color: #f2f2f2;
}
th,
td {
text-align: left;
padding: 8px;
}
th {
font-weight: bold;
}
tbody tr:nth-child(even) {
background-color: #f2f2f2;
}
tbody tr:hover {
background-color: #ddd;
}
```
这样就可以得到一个带有斑马线效果和鼠标悬停高亮效果的漂亮表格。
html好看的表格模板
以下是一个简单的HTML表格模板,你可以根据需要进行修改和美化:
```html
<table>
<thead>
<tr>
<th>表头1</th>
<th>表头2</th>
<th>表头3</th>
</tr>
</thead>
<tbody>
<tr>
<td>单元格1</td>
<td>单元格2</td>
<td>单元格3</td>
</tr>
<tr>
<td>单元格4</td>
<td>单元格5</td>
<td>单元格6</td>
</tr>
</tbody>
</table>
```
你可以通过CSS样式表来美化表格,例如:
```css
table {
border-collapse: collapse;
width: 100%;
max-width: 800px;
margin: 0 auto;
}
th, td {
border: 1px solid #ddd;
padding: 8px;
text-align: center;
}
th {
background-color: #f2f2f2;
color: #333;
font-weight: bold;
}
tr:nth-child(even) {
background-color: #f9f9f9;
}
```
这些样式将会使表格看起来更加美观,你可以根据需要进行修改。