WP二十七菜单颜色更改不起作用

问题描述 投票:1回答:1

通过将以下几行添加到childtheme style.css样式表中,我几乎成功地将WordPress的TwentySeventeen主题中的默认白色文本和灰色背景菜单颜色更改了。

菜单屏幕截图

enter image description here

但是,当我从子菜单中的任何给定选择上移开鼠标时,菜单仍然非常简短地显示默认菜单颜色。对于CSS来说,我是个黑客,花了数小时试图在线找到解决方案。有什么建议么?非常感谢。

/*Change Drop Down Menu and Sub-Menu Hover and Text Color */

.menu a:hover,
.menu li:hover>a {
  background-color: rgb(220, 225, 200) !important;
  /* light green */
  color: #000000 !important;
}
css menu background-color twentyseventeen
1个回答
1
投票

似乎是因为有2个背景,一个在li上,]

<< img src =“ https://image.soinside.com/eyJ1cmwiOiAiaHR0cHM6Ly9pLnN0YWNrLmltZ3VyLmNvbS85am1hVS5wbmcifQ==” width =“ 300”>

[a上的第二]

li上的灰色背景,因此您只需对其进行“重置”

.main-navigation li li:hover,
.main-navigation li li.focus {
  background: none;
}
© www.soinside.com 2019 - 2024. All rights reserved.