删除菜单中当前页面的下划线(Twenty Twenty 主题)



我刚刚将我的WP主题更改为Twenty Twenty。我的网站上有一个主菜单的顶部,我在这个菜单 atm 中只有 2 个链接。如果我在菜单的其中一个页面上,它会强调该链接。我想删除该功能。

网站链接: http://eclairblock.com

起初,我尝试添加这个额外的 CSS:

> .primary-menu-wrapper .primary-menu .current-menu-item {text-decoration: none;}

但它什么也没改变,如果而不是text-decoration: none

例如,我添加display: none,然后菜单中的当前页面链接消失。

我也尝试添加!important但它不起作用,因为当前页面在菜单中仍然带有下划线。

最后,我尝试通过从此部分中删除.primary-menu .current_page_ancestor来更改 style-rtf.css 文件:

.primary-menu a:hover,
.primary-menu a:focus,
.primary-menu .current_page_ancestor {
text-decoration: underline;
}

我还能尝试什么?

谢谢你们(很抱歉成为一个完全的 css 菜鸟(

您的规则被更具体的现有规则覆盖。请尝试:

.primary-menu li.current-menu-item > a {
text-decoration: none;
}

以下是有关 CSS 特异性的指南:https://www.w3schools.com/css/css_specificity.asp

最新更新