Css 访问divs中的类和id

Css 访问divs中的类和id,css,Css,如何访问这行代码中的最后一个div(div.access-example) <div id="footer-example" class="full-example"> <div id="footer-example2" class="fixed-example"> <div class="almost-there"> <div class="access-example"> 当这不起作用时,我添加了

如何访问这行代码中的最后一个div(div.access-example)

<div id="footer-example" class="full-example">

   <div id="footer-example2" class="fixed-example">

       <div class="almost-there">

          <div class="access-example">
当这不起作用时,我添加了
{code goes here!important;}
,以防有什么东西覆盖了它。我也试过带孩子(

注意:我不能使用
div.access-example
并添加我的代码,因为同一个div正在其他地方使用,我只需要在该特定位置更改它;因为这是一个Wordpress站点,我没有访问Ftp的权限,所以我需要访问嵌套的div

div div div .access-example
{
background-color:yellow;
}

您可以通过删除第二个类或id中的一个来改变。这很有效

#footer-example #footer-example2 .almost-there .access-example {
    color:red;
}
这同样有效

#footer-example .fixed-example .almost-there .access-example {
    color:red;
}

确保未使用Chrome开发工具或类似工具覆盖此(您的)
CSS
声明。

如果您只需要调用
.access示例
类,可以执行以下操作:

.access-example{}
如果需要层次结构,这也可以:

.full-example > .fixed-example > .almost-there > .access-example{}

.full-example>.fixed-example>.most-here>.access-example
试试这个为什么不
#footer-example.access-example
。CSS选择器越短越好。
#footer-example2.access-example
@RyanKinal他已经提到他不能这样使用,因为他在其他地方使用同一个类。这是有道理的,所以我试着这样做:#footer wrapper.full width wrapper.fixed width wrapper.one-third.first.one-third。这不管用,tho。我还尝试了儿童(>)。我在web浏览器控制台窗口中执行此操作,但我不明白这有什么关系。只要我只关注最后一节课,它就行了,现在行了。我需要做的是剪掉第一个id,然后继续上最后三节课。
.access-example{}
.full-example > .fixed-example > .almost-there > .access-example{}