可以使用 CSS 对表格进行样式调整。以下是一些常见的样式调整方法:
table {
border-collapse: collapse; /* 合并边框 */
border: 1px solid #ccc; /* 设置边框样式 */
}
tr:nth-child(even) {
background-color: #f2f2f2; /* 设置偶数行背景色 */
}
td {
padding: 8px; /* 设置单元格内边距 */
text-align: center; /* 设置单元格文字居中 */
}
th {
background-color: #4CAF50; /* 设置表头背景色 */
color: white; /* 设置表头文字颜色 */
padding: 8px; /* 设置表头内边距 */
}
table {
width: 100%; /* 设置表格宽度为100% */
height: 200px; /* 设置表格高度为200px */
}
以上是一些常见的样式调整方法,可以通过组合使用来实现更复杂的表格样式调整。