【问题标题】:Adjust height of dashboardheader in shinydashboard调整闪亮仪表板中仪表板标题的高度
【发布时间】:2016-09-15 14:19:19
【问题描述】:

我想知道如何调整dashboardheader 在shinydashboard 中的高度

dashboardHeader(
    title = loadingLogo('http://company.fr/','logo.jpg','buffpowa.gif'),
    titleWidth = 600
) 

我可以修改width,但徽标对于标题来说太大了。我希望标题有足够的高度来显示完整的徽标。

谢谢

【问题讨论】:

    标签: r shiny shinydashboard


    【解决方案1】:

    您需要设置以下元素的height:.main-header 和.main-header .logo。另请注意,只有将它们设置在 dropdown 类中的 tags$li 内才有效。

    代码

    library(shiny)
    library(shinydashboard)
    
    ui <- dashboardPage(
      dashboardHeader(
        # Set height of dashboardHeader
        tags$li(class = "dropdown",
          tags$style(".main-header {max-height: 200px}"),
          tags$style(".main-header .logo {height: 200px}")
        ),
        # Use image in title
        title = tags$a(href='http://company.fr/',
                       tags$img(src='logo.jpg'))
      ),
      dashboardSidebar(
        # Adjust the sidebar
        tags$style(".left-side, .main-sidebar {padding-top: 200px}")
      ),
      dashboardBody()
    )
    
    server <- function(input, output){}
    
    shinyApp(ui, server)
    

    示例

    使用 200x200 像素的安卓徽标:

    【讨论】:

    • 此解决方案适用于扩展仪表板的标题和标题,但如果要减小标题的大小,此解决方案不起作用(只会缩小标题部分)。一个新的question 询问这是否可能已经发布。谢谢
    猜你喜欢
    • 2017-05-21
    • 1970-01-01
    • 1970-01-01
    • 2015-04-22
    • 1970-01-01
    • 2018-02-24
    • 1970-01-01
    • 1970-01-01
    • 2018-01-24
    相关资源
    最近更新 更多