如何指定sidebarPanel的宽度(以像素为单位)?

时间:2017-10-14 15:30:55

标签: css r shiny

如何以像素为单位指定sidebarPanel的宽度?在我的情况下,width参数不够准确。

library(shiny)

ui <- fluidPage(
  sidebarLayout(
    sidebarPanel(width = 5), # This is not accurate enough!
    mainPanel()))

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

shinyApp(ui, server)

2 个答案:

答案 0 :(得分:1)

您还可以指定width作为百分比的函数,100% =全宽而不是将其硬编码为px

library(shiny)

ui <- fluidPage(
  sidebarLayout(
    div(style="width: 70%;",sidebarPanel(width = 5)), # This is not accurate enough!
    mainPanel()))

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

shinyApp(ui, server)

答案 1 :(得分:0)

R shiny - background of sidebar panel的帮助下,我找到了以下解决方案:

WHERE date_ready < DATE_ADD(CURDATE(), INTERVAL + 14 Day)
    -- Here -----------^

这个不影响其他library(shiny) ui <- fluidPage( tags$head(tags$style(HTML('#sidebar {width: 100px;}'))), sidebarLayout( sidebarPanel(id = "sidebar"), mainPanel())) server <- function(input, output, session) {} shinyApp(ui, server)