[模板] 交替相近颜色的表格

本文介绍了一种使用HTML和CSS实现的交替颜色表格样式方案。通过定义不同类别的单元格样式来区分不同的行背景颜色,并保持良好的视觉效果。适用于网页中需要展示大量数据的场景。

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

 
 
[模板] 交替相近颜色的表格
 
 
效果:
 
 
 
 
 
 
不用多说,直接看代码:
<style type="text/css">
td.title 
{
  width
: 142.0pt;
  border-top
: solid #4F81BD 1.0pt;      /*第一行 上边缘线 的颜色*/
  border-left
: none;
  border-bottom
: solid #4F81BD 1.0pt;   /*第一行 下边缘线 的颜色*/
  border-right
: none;
  padding
: 0cm 5.4pt 0cm 5.4pt;
}


td.withcolor 
{
  width
: 142.0pt;
  border
: none;
  background
: #D3DFEE;                                    /*有色行的颜色*/
  padding
: 0cm 5.4pt 0cm 5.4pt;
}


td.withwhite 
{
  width
: 142.0pt;
  border
: none;
  padding
: 0cm 5.4pt 0cm 5.4pt;
}


td.whitebottom 
{  
    width
: 142.0pt;
  border
: none;
  padding
: 0cm 5.4pt 0cm 5.4pt;
  border-bottom
: solid #4F81BD 1.0pt;
}


td.colorbottom 
{
    width
: 142.0pt;
  border
: none;
  padding
: 0cm 5.4pt 0cm 5.4pt;
  background
: #D3DFEE;
  border-bottom
: solid #4F81BD 1.0pt;
}

</style>


    
<table border="1" cellspacing="0" cellpadding="0" style='border:none;'>
        
<!--The Table Title Begins-->
      
<tr>
        
<td class="title">
          Number
        
</td>
        
<td class="title">
          Name
        
</td>
        
<td class="title">
          Sex
        
</td>
      
</tr>
      
<!--The Table Title Ends-->
      
      
      
<tr>
        
<td class="withcolor">
          1
        
</td>
        
<td class="withcolor">
          Peter
        
</td>
        
<td class="withcolor">
          Man
        
</td>
      
</tr>  
      
<tr>
        
<td class="withwhite">
          2
        
</td>
        
<td class="withwhite">
          Mary
        
</td>
        
<td class="withwhite">
          Woman
        
</td>
      
</tr>
      
      
<!--The Table Bottom Begins-->
      
<tr>
        
<td class="colorbottom">
          3
        
</td>
        
<td class="colorbottom">
          Lucy
        
</td>
        
<td class="colorbottom">
          Woman
        
</td>
      
</tr>
      
<!--The Table Bottom Ends-->
    
</table>
 
 
 
 
 
 
 
 
 
 
PS: 各种丰富的颜色,我已经做成了网页,直接打开就行:
 http://www.fs2you.com/files/920ca94a-f349-11dc-856a-00142218fc6e/
 
 
 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值