2017-06-02 80 views
0

我已經被要求從該頁面http://ccl.vincentandbell.com/partners/特定表CSS樣式

我試圖給表中的ID <div id="customtable">刪除灰色地帶,並增加我的style.css文件中的以下內容:

#customtable { 
    background-color: #fffff; 
} 

但是,這並沒有改變灰色區域的顏色。


這裏有一個灰色地帶的HTML:

<tr> 
    <td width="105"></td> 
    <td width="498"><strong>&nbsp;</strong><p></p> 
     <h3>Cumbria Methodist District</h3> 
     <p> 
      <a href="http://www.cumbriamethodistdistrict.org.uk/welcome.htm">http://www.cumbriamethodistdistrict.org.uk/welcome.htm</a> 
     </p> 
    </td> 
</tr> 

而CSS應用到它:

table tbody tr:nth-child(even) { 
    background-color: #f2f2f2; 
} 
+0

歡迎堆棧溢出!我編輯了你的問題,讓那些能夠幫助你的人更容易理解。請考慮包括您正在使用的主題的名稱以及指向其網頁的鏈接。我使用Chrome的[devtools](https://developers.google.com/web/tools/chrome-devtools/)來查找灰色區域的HTML和應用於它們的CSS(但是每個Web瀏覽器中都有類似的工具)。祝你好運! –

回答

0

看來,這裏有一個類:

table tbody tr:nth-child(even) 

您需要覆蓋此課程:

table tbody tr:nth-child(even) { 
    background-color: transparent!important; 
} 
0

更改此

table tbody tr:nth-child(even) { 
     background-color: #f2f2f2; 
    } 

TO

table tbody tr:nth-child(even) { 
     background-color: transparent; 
    } 
0

1)注意:您使用#fffff的顏色值,這是一個無效的顏色值 - 使用eiter #fff#ffffff( 6次f

2.)理論上,它應該與這個CSS補充說,作爲@Daniel FOIS寫道,因爲這相當於/覆蓋原來的CSS規則:

table tbody tr:nth-child(2n) { 
    background-color: #ffffff; 
} 

3)如果應限於特定頁面(而不是整個網站),你可以使用頁面ID類page-id-16(這是在body標籤)的組合CSS選擇器,再加上加!important,如果必要的話:

.page-id-16 table tr { 
    background-color: #ffffff !important; 
}