R闪亮输出的打印预览中未显示背景色

时间:2019-01-10 10:59:14

标签: r shiny

R Shiny完美地显示了输出。但是,当尝试从Chrome或Internet Explorer打印闪亮的输出时,在打印预览中我没有得到背景色,另存为pdf的页面也没有显示背景色。我还保留了“显示背景”选项。

library(shiny)

ui <- fluidPage(
h2("Text Background colour YELLOW not showing in Print Preview",
    style="background-color: yellow")
)

server <- function(input, output, session) {
}

shinyApp(ui, server)

下面是屏幕截图:

This is the browser view of R Shiny output

This is the print preview

1 个答案:

答案 0 :(得分:0)

在您添加到应用程序的任何CSS样式中添加“!important”会强制其使用此样式,而不是从某处继承样式并将背景更改为白色。

library(shiny)

ui <- fluidPage(
  h2("Text Background colour YELLOW not showing in Print Preview",
     style="background-color: yellow!important")
)

server <- function(input, output, session) {
}

shinyApp(ui, server)