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