Change hover-over font color of navbarPage menu bar in R Shiny

雨燕双飞 提交于 2019-12-25 18:45:34

问题


I'm attempting to change the colour of the font when the mouse hovers over the options on the navbarPage menubar in an R Shiny app by using a CSS file with contents:

.navbar-default:hover {
    color: #F2E836;
    background-color: #000000 !important;
}

However, this isn't working for me. Any guesses as to why?


回答1:


Try this:

.navbar-default .navbar-nav>li>a:focus, .navbar-default .navbar-nav>li>a:hover {
    color: #F2E836 !important;
    background-color: #000000 !important;
}

Omit !important if the style applies without it.

!important overrides other styles already defined on the same element. It is not a good practice to overuse !important as it makes obscure which line of CSS is applied to which element.

Hope this helps.




回答2:


See: Change color of bootstrap navbar on hover link?

(Apologies for repeating the question, but my question's title certainly more accurately reflects what I wanted to find out, hence why my searching didn't readily reveal the existing question!)



来源:https://stackoverflow.com/questions/50306821/change-hover-over-font-color-of-navbarpage-menu-bar-in-r-shiny

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!