问题
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