漂亮表格

本文详细介绍了如何使用CSS来创建美观的表格样式,并通过HTML实现表格布局,包含标题、行、列等元素的样式定制。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

http://peaklui.iteye.com/blog/381589


上面表格的代码:

Html代码  收藏代码
  1. <style type="text/css">  
  2. caption {   
  3.     padding: 0 0 5px 0;        
  4.     font: italic 30px "Trebuchet MS", Verdana, Arial, Helvetica, sans-serif;   
  5.     text-align: center;   
  6. }   
  7.       
  8. /*   
  9.   
  10.     TableCloth    
  11.     by Alen Grakalic, brought to you by cssglobe.com  
  12.       
  13. */ /* general styles */  
  14. table,td {  
  15.     font: 100% Arial, Helvetica, sans-serif;  
  16. }  
  17.   
  18. table {  
  19.     width: 100%;  
  20.     border-collapse: collapse;  
  21.     margin: 1em 0;  
  22. }  
  23.   
  24. th,td {  
  25.     text-align: left;  
  26.     padding: .5em;  
  27.     border: 1px solid #fff;  
  28. }  
  29.   
  30. th {  
  31.     background: #328aa4 url(tr_back.gif) repeat-x;  
  32.     color: #fff;  
  33. }  
  34.   
  35. td {  
  36.     background: #e5f1f4;  
  37. }  
  38.   
  39. /* tablecloth styles */  
  40. tr.even td {  
  41.     background: #e5f1f4;  
  42. }  
  43.   
  44. tr.odd td {  
  45.     background: #f8fbfc;  
  46. }  
  47.   
  48. th.over,tr.even th.over,tr.odd th.over {  
  49.     background: #4a98af;  
  50. }  
  51.   
  52. th.down,tr.even th.down,tr.odd th.down {  
  53.     background: #bce774;  
  54. }  
  55.   
  56. th.selected,tr.even th.selected,tr.odd th.selected {  
  57.       
  58. }  
  59.   
  60. td.over,tr.even td.over,tr.odd td.over {  
  61.     background: #ecfbd4;  
  62. }  
  63.   
  64. td.down,tr.even td.down,tr.odd td.down {  
  65.     background: #bce774;  
  66.     color: #fff;  
  67. }  
  68.   
  69. td.selected,tr.even td.selected,tr.odd td.selected {  
  70.     background: #bce774;  
  71.     color: #555;  
  72. }  
  73.   
  74. /* use this if you want to apply different styleing to empty table cells*/  
  75. td.empty,tr.odd td.empty,tr.even td.empty {  
  76.     background: #fff;  
  77. }  
  78. </style>  
  79.   
  80. <table>  
  81.     <caption>caption</caption>  
  82. <tr>  
  83.     <th>...</th>  
  84.     <th>...</th>  
  85.     <th>...</th>  
  86.     <th>...</th>  
  87.     <th>...</th>  
  88.     <th>...</th>  
  89. </tr>  
  90.   
  91.   
  92. <tr>  
  93.     <td>...</td>  
  94.     <td>...</td>  
  95.     <td>...</td>  
  96.     <td>...</td>  
  97.     <td>...</td>  
  98.     <td>...</td>  
  99. </tr>  
  100.   
  101.   
  102. <tr>  
  103.     <td>...</td>  
  104.     <td>...</td>  
  105.     <td>...</td>  
  106.     <td>...</td>  
  107.     <td>...</td>  
  108.     <td>...</td>  
  109. </tr>  
  110.   
  111. <tr>  
  112.     <td>...</td>  
  113.     <td>...</td>  
  114.     <td>...</td>  
  115.     <td>...</td>  
  116.     <td>...</td>  
  117.     <td>...</td>  
  118. </tr>  
  119.   
  120. <tr>  
  121.     <td>...</td>  
  122.     <td>...</td>  
  123.     <td>...</td>  
  124.     <td>...</td>  
  125.     <td>...</td>  
  126.     <td>...</td>  
  127. </tr>  
  128. </table>  

 


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值