在闪亮的仪表板和传单中覆盖框的高度

时间:2016-02-25 05:10:42

标签: css r height shiny dashboard

我使用shinyDashboard创建了一个信息中心,我有一张leaflet的地图。 shinyDashboard中使用的box元素为地图创建了400px的固定高度。

我希望地图为90vh,以便覆盖大部分屏幕,因此我在UI文件中写了这个:

tabItem(tabName = "widgets",
              fluidPage(
                fluidRow(
                  tags$head(tags$style(type = "text/css",'
                                            #geomap {
                                            height: 90vh;
                                            }
                                            ')),
                  box(title = "Geographical distribution",
                    leafletOutput("geomap")
                  )
                )
              )
      )

现在,当我检查页面时,我可以看到该属性已传递到#geomap id,但由于某种原因被覆盖

此外,这是节点

我在成功之前已经覆盖了类,所以我不明白如何不能覆盖ID。有什么想法吗?

谢谢!

编辑:这是一个示例代码:

library(shiny)
library(shinydashboard)
library(leaflet)


server <- function(input, output, session) {
  output$geomap <- renderLeaflet({
    m <- leaflet(data) %>%
      addProviderTiles("CartoDB.Positron")

  })
}

ui <- dashboardPage(skin = "black",
                    dashboardHeader(title = "Test"),
                    dashboardSidebar(
                      sidebarMenu(
                        menuItem("Map distribution", tabName = "widgets", icon = icon("th"))
                      )
                    ),


                    dashboardBody(
                      tabItems(
                        tabItem(tabName = "widgets",
                                fluidPage(
                                  fluidRow(
                                    tags$head(tags$style(HTML('
                                            .col-sm-6 {
                                                              width: 100%;
                                                              }
                                                              '))),
                                    box(title = "Geographical distribution",
                                        leafletOutput("geomap")
                                    )
                                    )
                                  )
                                )
                          )
                      )
                    )

shinyApp(ui, server)

0 个答案:

没有答案