Wordpress 最后一个子背景色
我正在使用这个基于bootstrap3的Wordpress主题,我希望菜单的最后一个子菜单具有不同的背景。 我试过:Wordpress 最后一个子背景色,wordpress,twitter-bootstrap-3,Wordpress,Twitter Bootstrap 3,我正在使用这个基于bootstrap3的Wordpress主题,我希望菜单的最后一个子菜单具有不同的背景。 我试过: .nav > li:last-child > a { background: red; padding-right: 0 !important; } 以下是主题和代码: <nav id="site-navigation" class="main-navigation text-center" role="navigation">
.nav > li:last-child > a {
background: red;
padding-right: 0 !important;
}
以下是主题和代码:
<nav id="site-navigation" class="main-navigation text-center" role="navigation">
<div id="primary-menu" class="menu"><ul>
<li class="page_item page-item-2"><a href="https://wp-themes.com/?page_id=2">About</a></li>
<li class="page_item page-item-46 page_item_has_children"><a href="https://wp-themes.com/?page_id=46">Parent Page</a>
<ul class="children">
<li class="page_item page-item-49"><a href="https://wp-themes.com/?page_id=49">Sub-page</a></li>
</ul>
</li>
</ul></div>
</nav>
谢谢你可以试试这个。因为导航是标记而不是类,所以你不需要导航前的点
nav ul > li:last-child > a {
background: red;
padding-right: 0 !important;
}
或者您可以看到此参考LE:Solved。主导航li:last child{背景:红色!重要;}
nav ul > li:last-child > a {
background: red;
padding-right: 0 !important;
}
nav ul li:last-child > a {
background: red;
padding-right: 0 !important;
}