2013-01-14 136 views
1

我有一張表,我目前做的斑馬條紋與行,甚至和奇數的工作正常。我的問題是,我也有一個類用於指示不同顏色樣式的新行。看起來這個新類正在被斑馬條紋CSS拋出,有沒有辦法解決這個問題?任何提示或建議表示讚賞,謝謝。從某些行中刪除斑馬條紋

這裏有點CSS的。如果你把爲新創建的元素代碼前的斑馬線剝離行CSS控制該表

#table tbody tr:nth-child(odd){ 
    background-color: #cccccc; color:black; 
    } 
    #table tbody tr:nth-child(even){ 
    background: #EBEBEB; color: #7D7D7D; 
    } 
    #table tbody tr:nth-child(2n+1):hover{ 
     cursor:pointer; 
     /* add gradient */ 
     background-color: #808080; 
     background: -webkit-gradient(linear, left top, left bottom, from(#909090), to(#606060)); 
     background: -moz-linear-gradient(top, #909090, #606060); 
     color: #dadada; 
     font-weight: ; 
    } 
    #table tbody tr:nth-child(2n):hover{ 
     cursor:pointer; 
     /* add gradient */ 
     background-color: #808080; 
     background: -webkit-gradient(linear, left top, left bottom, from(#909090),  to(#606060)); 
     background: -moz-linear-gradient(top, #909090, #606060); 
     color: #dadada; 

    } 
    .new { 
    background-color: #760086; 
    color:white; 
     } 

回答

0

,那麼它應該只是罰款:

p:nth-child(2n+1){ 
    /*blah*/ 
} 
p:nth-child(2n){ 
    /*blah*/ 
} 
p.new{ 
    /*blah*/ 
} 

現場演示:http://jsfiddle.net/DerekL/ZFcKs/

+0

這是我想太多,但很可惜沒有骰子呢。我剛剛刪除斑馬的CSS和新班正在申請。 :S – kabuto178

+0

@ kabuto178 - 您是否已將'!important'放入您的任何代碼中?這可能會覆蓋'new'類的代碼。 –

+0

不,我沒有使用!在我的CSS中很重要。我可以做? – kabuto178