知识点概述:
1、<table>的bgcolor属性:用来指定整个表格的背景颜色
2、<th>的bgcolor属性:用来指定表格中栏目行的背景颜色
3、<tr>标记的bgcolor属性:用来指定表格中一行的背景颜色
4、<td>标记的bgcolor属性:用来指定表格中一格的背景颜色
代码demo:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- 表格背景色 -->
<!--
1、<table>的bgcolor属性:用来指定整个表格的背景颜色
2、<th>的bgcolor属性:用来指定表格中栏目行的背景颜色
3、<tr>标记的bgcolor属性:用来指定表格中一行的背景颜色
4、<td>标记的bgcolor属性:用来指定表格中一格的背景颜色
-->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>表格背景颜色演示...</title>
<style type="text/css">
td {
text-align: center;
}
</style>
</head>
<body>
<table bgcolor="#00FFFF" border="1" cellspacing="0" width="40%" height="400"><!-- th标签比td标签"加粗"了一点 -->
<!-- 设置表格标题 -->
<caption> <font size="5pt"> <b>学生信息统计</b> </font> </caption>
<tr> <th bgcolor="#FFD306">姓名</th> <th>性别</th> <th>年龄</th> </tr>
<tr bgcolor="#66B3FF"> <td>Jack</td> <td>男</td> <td>20</td> </tr>
<tr> <td>张三</td> <td>男</td> <td>30</td> </tr>
<tr> <td>Rose</td> <td>女</td> <td>22</td> </tr>
<tr> <td bgcolor="#FF5809">李四</td> <td>男</td> <td>33</td> </tr>
</table>
</body>
</html>
页面显示: