Change font and color in helpText()

假如想象 提交于 2021-02-11 13:52:47

问题


How can I change the font and the color of helpText() in a shiny app?

library(shiny)
library(shinydashboard)
library(shinydashboardPlus)
shinyApp(
  ui = dashboardPagePlus(
    header = dashboardHeaderPlus(
      left_menu = tagList(
        helpText(   a(target="_blank","Login",href="https://www.youtube.com/")
        )
      )
    ),
    sidebar = dashboardSidebar(),
    body = dashboardBody(),
  ),
  server = function(input, output) { }
)

回答1:


You could modify the css class of the element. The css selector is .help-block a: (.NAME is for selecting a class named NAME and a is for selecting the child element with tagname a).

tags$head(
  tags$style(HTML(".help-block a {color: #ff0000 !important;}"))
)

Reproducible example:

library(shiny)
library(shinydashboard)
library(shinydashboardPlus)

shinyApp(
  ui = dashboardPagePlus(
    tags$head(
       tags$style(HTML(".help-block a {color: #ff0000 !important;}"))
    ),
    header = dashboardHeaderPlus(
      left_menu = tagList(
        helpText(   a(target="_blank","Login",href="https://www.youtube.com/")
        )
      )
    ),
    sidebar = dashboardSidebar(),
    body = dashboardBody(),
  ),
  server = function(input, output) { }
)


来源:https://stackoverflow.com/questions/59292157/change-font-and-color-in-helptext

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