[英]Add Black Border to SidebarPanel and MainPanel - R Shiny
我如何在 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)
})
您可以考虑将自定义 css 添加到您的应用程序。 我在应用程序运行时右键单击它以“检查”我想更改的 css class。
这是一个使用内联代码的示例。
这是考虑其他方法的链接,例如获取 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)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.