Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/41.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Css Shinydashboard仪表板侧栏宽度设置_Css_R_Width_Shiny - Fatal编程技术网

Css Shinydashboard仪表板侧栏宽度设置

Css Shinydashboard仪表板侧栏宽度设置,css,r,width,shiny,Css,R,Width,Shiny,我正在使用R(RRO 8.0.3 CRAN-R 3.1.3)中的(0.12.0)和(0.4.0)创建一个UI,我喜欢我看到的。但是,我希望能够控制仪表板侧栏项的宽度,因为我需要在其中放置一些较宽的选择器框 ui <- dashboardPage( dashboardHeader(title = "My Dashboard"), dashboardSidebar(#stuffhere) #would like a width param setting dashboardBod

我正在使用R(RRO 8.0.3 CRAN-R 3.1.3)中的(0.12.0)和(0.4.0)创建一个UI,我喜欢我看到的。但是,我希望能够控制
仪表板侧栏
项的宽度,因为我需要在其中放置一些较宽的选择器框

ui <- dashboardPage(
  dashboardHeader(title = "My Dashboard"),
  dashboardSidebar(#stuffhere)  #would like a width param setting
  dashboardBody()
)

ui侧边栏的宽度由
类左侧的CSS设置,因此您可以执行以下操作:

dashboardPage(
  dashboardHeader(title = "My Dashboard"),
  dashboardSidebar( tags$style(HTML("
      .main-sidebar{
        width: 300px;
      }
    ")),selectInput("id","Select a survey",choices=c("Very very very very long text","text"))), 
    dashboardBody()
  )

旧的答案可能仍然有效,但现在还有一个
width=…
选项。见: . 下面是上面显示的示例代码:

shinyApp(
  ui = dashboardPage(
    dashboardHeader(
      title = "Title and sidebar 350 pixels wide",
      titleWidth = 350
    ),
    dashboardSidebar(
      width = 350,
      sidebarMenu(
        menuItem("Menu Item")
      )
    ),
    dashboardBody()
  ),
  server = function(input, output) { }
)

那对你有用吗?它没有改变我的格式。我会尝试一些变体。是的,对我来说很有效,也许我们没有相同的
shinydashboard
版本,我正在运行
shinydashboard_0.2.3
shinydashboard_0.11.1.9005
。左侧不起作用。在页面上做了一次检查,用.main侧边栏{…}做了同样的尝试,结果成功了!是的,我更新了我的软件包,侧边栏的类现在是
main sidebar
,为了让一切看起来正常,我不得不在
dashboard
函数中添加以下css:
tags$head(tags$style(HTML('.main sidebar{width:300px;}.main header>.navbar{margin left:300px;}).main header.logo{width:300px;}.content wrapper,.main footer,.right{margin left:300px;}')))