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 宇视监控服务器无法登录
  • ¥15 PADS Logic 原理图
  • ¥15 PADS Logic 图标
  • ¥15 电脑和power bi环境都是英文如何将日期层次结构转换成英文
  • ¥15 DruidDataSource一直closing
  • ¥20 气象站点数据求取中~
  • ¥15 如何获取APP内弹出的网址链接
  • ¥15 wifi 图标不见了 不知道怎么办 上不了网 变成小地球了
  • ¥50 STM32单片机传感器读取错误
  • ¥50 power BI 从Mysql服务器导入数据,但连接进去后显示表无数据