2017-06-02 163 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; 
}