dony113407 2018-06-19 18:06
浏览 208
已采纳

在Wordpress主菜单链接上更改悬停颜色

I have small issue with my main menu.

I want to update my hover color when close to menu item. Currently menu color is white on black background, but when close to menu item, it going black also, and its not visible at all. I tryed to update color in this way:

    .piko-layout-header .piko-navbar .piko-mega-menu.piko-mega-menu- 
    light.dark>.nav.navbar-nav>li .dropdown-menu>li>a:hover {
     color:#fff;
     } 

but seems do not make any change. To explain better with image:

menu problem issue

Thanks!!

  • 写回答

1条回答 默认 最新

  • dongzuoyue6556 2018-06-19 19:01
    关注

    One thing I despise about so many custom built in CSS styles is the unnecessarily heavily selectors that overwrite each other.

    Here's the current CSS that's styling it black:

    /*... */
    .piko-layout-header .piko-navbar .piko-mega-menu > .nav.navbar-nav > li > .piko-link:hover,
    /*...*/ {
        color: #141414 !important
    }
    

    Blech. You can confirm this by opening dev tools and adding the :hover pseudo class to the link.

    Stick this in your CSS after the skin-green-dark file or in the Appearance > Customizer > Additional CSS:

    .piko-layout-header .piko-navbar .piko-mega-menu > .nav.navbar-nav > li > .piko-link:hover {
        color: #fff !important;
    }
    

    If that's still being overwritten it means it's been overwritten with that selector above, and you can make yours a bit heavier with more specificity by changing it to:

    header.piko-layout-header .piko-navbar .piko-mega-menu > .nav.navbar-nav > li > .piko-link:hover {
        color: #fff !important;
    }
    

    These hyper specific selectors become such a hassle especially when they start throwing !important around that they become incredibly tedious to overwrite.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 关于大棚监测的pcb板设计
  • ¥20 sim800c模块 at指令及平台
  • ¥15 stm32开发clion时遇到的编译问题
  • ¥15 lna设计 源简并电感型共源放大器
  • ¥15 如何用Labview在myRIO上做LCD显示?(语言-开发语言)
  • ¥15 Vue3地图和异步函数使用
  • ¥15 C++ yoloV5改写遇到的问题
  • ¥20 win11修改中文用户名路径
  • ¥15 win2012磁盘空间不足,c盘正常,d盘无法写入
  • ¥15 用土力学知识进行土坡稳定性分析与挡土墙设计