firmo23
firmo23

Reputation: 8454

Change the background color of specific part of shinydashboard body

I have the .rmd file below and I display it via a shiny app. I want to change the background color to white in the whole space that is included into these 6 columns space and not only the titles. How can I do this? The remaining 6 columns (3 left, 3 right) should remain the same color.

enter image description here app.r

library(shiny)
library(shinydashboard)
library(shinydashboardPlus)
library(shinyjs)
library(knitr)
library(rmarkdown)

dbHeader <- dashboardHeaderPlus(disable = TRUE
                                
                                
)
shinyApp(
  ui = dashboardPagePlus(
    header = dbHeader,
    sidebar = dashboardSidebar(width = "0px",
                               sidebarMenu(id = "sidebar" # id important for updateTabItems
                                           
                               )          ),
    body = dashboardBody(
      tags$head(tags$style(HTML('
  h1{
  font-size: 12pt;
  font-family: "Montserrat Light", sans-serif;
  text-align: justify;
  background-color: white;
}
  H1.title{
  font-size: 44pt;
  font-family: "Chronicle Display Light", Times, serif;
  text-align: right;
  background-color: white;
}
  H1{
  font-size: 44pt;
  font-family: "Chronicle Display Light", Times, serif;
  text-align: right;
  background-color: white;
}
  H2{
  font-size: 16pt;
  font-weight: bold;
  font-family: "Chronicle Display Light", Times, serif;
  text-align: left;
  background-color: white;
}
    '))),
      
      useShinyjs(),
      tags$script(HTML("$('body').addClass('fixed');")),
      fluidRow(
        column(3,),
        column(6,
      uiOutput("info")))
      
      
      
    )
    
  ),
  server<-shinyServer(function(input, output,session) { 
    hide(selector = "body > div > header > nav > a")
    
    
    output$info <- renderUI({
      
      isolate(HTML(markdown::markdownToHTML(knit('Information2.rmd', quiet = TRUE),fragment.only=TRUE)))
      
    })
    
    
  }
  )
)

Information2.rmd

---
output:
  html_document: default
  pdf_document: default
---


# Participant Information  

## What is this study called and who is involved?  
The full title of this study is “Life, death and statins: Survival analysis of elderly general practice patients in relation to statin prescriptions”. The short title is “Life, death & statins.” The investigators are Dr Adam Hodgkins, A/Prof Judy Mullan, Dr Darren Mayne, and Prof Andrew Bonney. All investigators are affiliated with the University of Wollongong. 

Upvotes: 0

Views: 108

Answers (1)

stefan
stefan

Reputation: 125807

This could be achieved by adding the CSS rule

#info {
    background-color: white;
}

info is the id of the div tag which contains the content of your Rmd.

enter image description here

Upvotes: 1

Related Questions