css 在侧边栏面板和主面板上添加黑色边框- R Shiny

jhiyze9q  于 2023-01-18  发布在  其他
关注(0)|答案(1)|浏览(150)

我该如何在MRE的主面板和侧边栏面板上添加黑色边框?我希望面板能稍微突出一些。我已经调整了应用程序的背景色,但我认为添加黑色边框会使每个面板更突出。
用户界面

library(shiny)
library(shinyalert)

# Define UI for application that draws a histogram
shinyUI(fluidPage(

    # Application title
    titlePanel("Old Faithful Geyser Data"),

    # Sidebar with a slider input for number of bins
    sidebarLayout(
        sidebarPanel(
            
        ),

        # Show a plot of the generated distribution
        mainPanel(
          DT::dataTableOutput("cap_table"),

        )
    )
))

服务器

library(shiny)
library(shinyalert)

data <- data.frame(x=rnorm(10),y=rnorm(10))

# Define server logic required to draw a histogram
shinyServer(function(input, output) {

  
  # render data selection
  output$cap_table <- DT::renderDataTable(data)

    

})
rjee0c15

rjee0c151#

你可以考虑在你的应用程序中添加自定义css,当应用程序运行时我右键点击它来“检查”我想修改的css类。
下面是一个使用内联代码的示例。
这里有一个链接,可以考虑其他方法,如源css文件。https://shiny.rstudio.com/articles/css.html

library(shiny)
library(DT)

# Define UI for application that draws a histogram
ui <- shinyUI(
  fluidPage(
  tags$head(
    # Note the wrapping of the string in HTML()
    tags$style(HTML(".well {
        border: 1px solid #000000;
      }")), 
    tags$style(HTML(".col-sm-8 {
        border: 1px solid #000000;
      }"))
  ),
  # Application title
  titlePanel("Old Faithful Geyser Data"),
  
  # Sidebar with a slider input for number of bins
  sidebarLayout(
    sidebarPanel(
      
    ),
    
    # Show a plot of the generated distribution
    mainPanel(
      DT::dataTableOutput("cap_table"),
      
    )
  )
))

data <- data.frame(x=rnorm(10),y=rnorm(10))

# Define server logic required to draw a histogram
server <- shinyServer(function(input, output) {
  
  
  
  # render data selection
  output$cap_table <- DT::renderDataTable(data)
  
  
  
})

shinyApp(ui = ui, server = server)

相关问题