gpt4 book ai didi

html - wordpress 中菜单事件项上的背景图像未突出显示

转载 作者:行者123 更新时间:2023-11-28 03:10:02 25 4
gpt4 key购买 nike

我在 wordpress 中创建了一个菜单,其中主页由图像而不是“主页”一词表示,并将其作为背景图像插入。问题是事件菜单项也有高亮效果,当主页处于事件状态时我的图像没有显示。

我的代码是:

#topmenu li:first-child a {
color: transparent;
}

#topmenu li:first-child {
background-image: url('http://localhost/plugandboomwordpress/wp-content/uploads/2015/04/logo.png');
background-size: 100px;
background-repeat: no-repeat;
background-position: bottom;
}

#topmenu a:hover {
background: darkgray;
color: white;
transition: background-color .5s;
}

#topmenu li:first-child a:hover {
background-image: url('http://localhost/plugandboomwordpress/wp-content/uploads/2015/04/logo.png');
background-size: 100px;
background-repeat: no-repeat;
background-position: bottom;
}

#topmenu .current-menu-item a {
background: darkgray;
color: white;
}

关于如何解决这个问题的任何想法?谢谢!

最佳答案

首先尝试将重复的 css 分组到这样的组中:

#topmenu li:first-child,
#topmenu li:first-child a:hover{
background-image: url('http://localhost/plugandboomwordpress/wp-content/uploads/2015/04/logo.png');
background-size: 100px;
background-repeat: no-repeat;
background-position: bottom;
}

然后尝试在这些规则之后添加 !important:

#topmenu .current-menu-item:first-child a {
background-image: url('http://localhost/plugandboomwordpress/wp-content/uploads/2015/04/logo.png') !important;
}

关于html - wordpress 中菜单事件项上的背景图像未突出显示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30917143/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com