英文:
How can I change the font color of an accordion menu in a shiny app?
问题
I want to recreate the following accordion menu:
I am using the accordion()
function from the shinydashboardPlus
package, and got to here so far:
I am trying to change the font color to black to match the first image, but adding the following CSS code is not working:
tags$head(
tags$style(
HTML(".box-title {
color: black !important;
}")
)
)
If someone could help me to change the font color, and if possible to add the well (AKA: the white rectangle with circled borders around each item of the accordion menu) it would be great!
Here is the full app code:
library(shiny)
library(shinydashboard)
library(shinydashboardPlus)
ui <- fluidPage(
tags$head(
tags$style(
HTML(".box-title {
color: black !important;
}")
)
),
accordion(
id = "covenants",
accordionItem(
title = "Cash on cash",
status = "danger",
collapsed = TRUE,
"This is some text!"
),
accordionItem(
title = "Net Portfolio Yield Percentage",
status = "warning",
collapsed = TRUE,
"This is some text!"
),
accordionItem(
title = "Minimum Liquidity Amount",
status = "warning",
collapsed = TRUE,
"This is some text!"
),
accordionItem(
title = "Maximum Debt to Equity Ratio",
status = "warning",
collapsed = TRUE,
"This is some text!"
),
accordionItem(
title = "Most Favored Nation",
status = "warning",
collapsed = TRUE,
"This is some text!"
)
)
)
server <- function(input, output, session) {}
shinyApp(ui, server)
英文:
I want to recreate the following accordion menu:
I am using the accordion()
function from the shinydashboardPlus
package, and got to here so far:
I am trying to change the font color to black to match the first image, but adding the following CSS code is not working:
tags$head(
tags$style(
HTML("
.box-title {
color: black !important;
}
")
)
)
If someone could help me to change the font color, and if possible to add the well (AKA: the white rectangle with circled borders around each item of the accordion menu) it would be great!
Here is te full app code:
library(shiny)
library(shinydashboard)
library(shinydashboardPlus)
ui <- fluidPage(
tags$head(
tags$style(
HTML("
.box-title {
color: black !important;
}
")
)
),
accordion(
id = "covenants",
accordionItem(
title = "Cash on cash",
status = "danger",
collapsed = TRUE,
"This is some text!"
),
accordionItem(
title = "Net Portfolio Yield Percentage",
status = "warning",
collapsed = TRUE,
"This is some text!"
),
accordionItem(
title = "Minimum Liquidity Amount",
status = "warning",
collapsed = TRUE,
"This is some text!"
),
accordionItem(
title = "Maximum Debt to Equity Ratio",
status = "warning",
collapsed = TRUE,
"This is some text!"
),
accordionItem(
title = "Most Favored Nation",
status = "warning",
collapsed = TRUE,
"This is some text!"
)
)
)
server <- function(input, output, session) {}
shinyApp(ui, server)
答案1
得分: 0
.box-title
选择器针对手风琴的标题,通常是一个超链接。默认情况下,超链接具有特殊样式,包括不同颜色的已访问和未访问链接。color属性仅适用于未访问链接,而:visited选择器可用于定位已访问链接。
因此,正确的CSS代码是:
.box-title a {
color: black !important;
}
英文:
The .box-title
selector targets the title of the accordion, which is usually a hyperlink. By default, hyperlinks have a special style that includes a different color for visited and unvisited links. The color property only applies to unvisited links, whereas the :visited selector can be used to target visited links
Therefore, the correct CSS code is:
.box-title a {
color: black !important;
}
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论