当前第2页 返回上一页
CSS通过color属性设置表格中文字的颜色,通过background属性设置表格的背景颜色。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 | <span style= "font-size:24px;" ><html>
<head>
<title>
年度收入
</title>
<style>
<!--
body{
background-color:#ebf5ff;
margin:0px;
padding:4px;
text-align:center;
}
.datalist{
color:#0046a6;
background-color:#d2e8ff;
font-family:Arial;
}
.datalistcaption{
font-size:18px;
font-weight:bold;
}
.datalistth{
color:#003e7e;
background-color:#7bb3ff;
}
-->
</style>
</head>
<body>
<tablesummary= "This table shows the yearly income for years 2004 through2007" border= "1" >
<caption>年度收入2004-2007</caption>
<tr>
<th></th>
<thscope= "col" >2004</th>
<thscope= "col" >2005</th>
<thscope= "col" >2006</th>
<thscope= "col" >2007</th>
</tr>
<tr>
<thscope= "row" >捐款</th>
<td>11.980</td>
<td>12.650</td>
<td>9.700</td>
<td>10.600</td>
</tr>
<tr>
<thscope= "row" >拨款</th>
<td>11.980</td>
<td>12.650</td>
<td>9.700</td>
<td>10.600</td>
</tr>
<tr>
<thscope= "row" >投资</th>
<td>11.980</td>
<td>12.650</td>
<td>9.700</td>
<td>10.600</td>
</tr>
<tr>
<thscope= "row" >募捐</th>
<td>11.980</td>
<td>12.650</td>
<td>9.700</td>
<td>10.600</td>
</tr>
<tr>
<thscope= "row" >销售</th>
<td>11.980</td>
<td>12.650</td>
<td>9.700</td>
<td>10.600</td>
</tr>
</table>
</body>
</html></span>
|
此时,可以看到页面的背景色、表格背景色、行列的名称颜色、字体都进行了相应的变化,而这些设置和文字的CSS设置完全相同,与页面背景的设置也完全一样。
【推荐学习:css视频教程】
以上就是css怎么设置table颜色的详细内容,更多文章请关注木庄网络博客!
返回前面的内容
相关阅读 >>
css布局方法有哪些
css框模型规定了什么作用
css如何实现表格实线
css如何设置竖排文字
css如何设置元素不可见
css表示什么
css怎么改变div字体颜色
css中display属性怎么用
css和html区别是什么
css目标选择器有哪些
更多相关阅读请进入《css》频道 >>
人民邮电出版社
本书对 Vue.js 3 技术细节的分析非常可靠,对于需要深入理解 Vue.js 3 的用户会有很大的帮助。——尤雨溪,Vue.js作者
转载请注明出处:木庄网络博客 » css怎么设置table颜色