【问题标题】:Make image used as title of shinydashboard fits exactly in the title box使用作闪亮仪表板标题的图像完全适合标题框
【发布时间】:2020-03-29 02:56:14
【问题描述】:

我已将图像作为闪亮仪表板的标题,并调整了其大小以适应高度和宽度,但左侧有一小部分仍为空。我怎样才能使它完全适合盒子? (附图的蓝色部分为空)

# app.R ##
library(shiny)
library(shinydashboard)
library(shinydashboardPlus)
library(DT)
library(shinyWidgets)
library(shinyjs)

dbHeader <- dashboardHeaderPlus(
  enable_rightsidebar = TRUE,
  rightSidebarIcon = "gears",
  fixed = T,
  title = tags$a(href='http://mycompanyishere.com',
                                 tags$img(src='logo.png',height = "55px",width="232px"))
)

ui <- dashboardPagePlus(
  dbHeader,
  dashboardSidebar(),
  dashboardBody(
    useShinyjs(),
    tags$hr(),
    tabsetPanel(
      id ="tabA",
      type = "tabs",
      tabPanel("Front",icon = icon("accusoft")),
      tabPanel("Data", icon = icon("table")
      )
    )
  ),
  rightsidebar = rightSidebar()
)

server <- function(input, output) {

}

shinyApp(ui = ui, server = server)

【问题讨论】:

    标签: r shiny shinydashboard


    【解决方案1】:

    为此,您需要修改仪表板 CSS(即填充)。一种方法是插入

     tags$head(tags$style(".skin-blue .main-header .logo { padding: 0px;}")),
    

    dashboardBody()

    然后输出看起来像这样(我没有你的标志,但从下面的图片中,你可以看到蓝色部分消失了)。

    有关如何在 Shiny 中设置应用样式的更多信息,请参见此处:https://shiny.rstudio.com/articles/css.html

    【讨论】:

    • 我很乐意提供帮助。
    猜你喜欢
    • 1970-01-01
    • 2021-05-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-02-24
    • 1970-01-01
    • 2017-02-10
    • 2021-02-28
    相关资源
    最近更新 更多