R Shiny: How do you change the background color of

2020-08-18 06:03发布

问题:

I am writing a shiny application and I would like to customize the look of the header. I am able to add images and format the text, but what I would like to do is change the background color, but only for the header panel, not the rest of the ui. So far I have this for my

ui.r:

shinyUI(pageWithSidebar(

headerPanel(
list(tags$head(tags$style("body {background-color: black; }")),
"Graphs", HTML('<img src="ah_large_black.gif", height="200px"    
style="float:right"/>','<p style="color:red"> test test </p>' ))
),

This has text of two different colors and puts an image on the right side, but it make the background color of everything black. Is there a way to limit the color this to just the header?

回答1:

Try something like

tags$style(".span12 {background-color: black;}")

instead of

tags$style("body {background-color: black;}")


标签: r shiny