更改R Shiny中navbarPage菜单栏的悬停字体颜色 [英] Change hover-over font color of navbarPage menu bar in R Shiny

查看:601
本文介绍了更改R Shiny中navbarPage菜单栏的悬停字体颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当鼠标悬停在R Shiny应用程序中的navbarPage菜单栏上的选项上时,我试图通过使用包含以下内容的CSS文件来更改字体的颜色:

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?

推荐答案

尝试一下:

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

如果没有样式,则忽略!important.

Omit !important if the style applies without it.

!important会覆盖已在同一元素上定义的其他样式.过度使用!important不是一个好习惯,因为它会使CSS的哪一行应用到哪个元素上变得晦涩难懂.

!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.

希望这会有所帮助.

这篇关于更改R Shiny中navbarPage菜单栏的悬停字体颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆