调整图像、操作按钮和tι的位置;shinydashboard收割台中的tle

调整图像、操作按钮和tι的位置;shinydashboard收割台中的tle,r,shiny,shinydashboard,R,Shiny,Shinydashboard,我在下面有一个闪亮的应用程序,我想在标题中放一张图片,一个标题和四个动作按钮,就像附加的屏幕截图一样。4个按钮应位于标题下方,且不覆盖图像。我怎样才能适应它?是否取决于屏幕分辨率?字体和字体大小不应更改 应该是这样的: 库(闪亮) 图书馆(shinydashboard) 图书馆(shinydashboardPlus) 图书馆(shinyjs) mytitle过多的左侧填充将其推向右侧。试试这个 mytitle <- paste0("Life, Death & Stat

我在下面有一个闪亮的应用程序,我想在标题中放一张图片,一个标题和四个动作按钮,就像附加的屏幕截图一样。4个按钮应位于标题下方,且不覆盖图像。我怎样才能适应它?是否取决于屏幕分辨率?字体和字体大小不应更改

应该是这样的:

库(闪亮)
图书馆(shinydashboard)
图书馆(shinydashboardPlus)
图书馆(shinyjs)

mytitle过多的左侧填充将其推向右侧。试试这个

mytitle <- paste0("Life, Death & Statins")
dbHeader <- dashboardHeaderPlus(
  titleWidth = "0px",
  tags$li(a(
    div(style = "margin-left:-15px;margin-bottom:-78px;margin-top:-15px;padding: 0px 1190px 0px 0px ; width: 290px;",
        img(src = 'UOW.png', height = "155px",width="232px")),
    div(style="display: inline;margin-top:-35px; padding: 0px 50px 0px 700px ;font-size: 44px ;color:#001641;font-family:Chronicle Display Light; width: 500px;",HTML(mytitle)),
    
    div(style="display: inline; margin-top:15px; padding: 0px 0px 0px 700px;vertical-align:top; width: 150px;", actionButton("info", "Information", 
                                                                                                                          style=" background-color: #faf0e6; border-color: #faf0e6")),
    div(style="display: inline;padding: 0px 0px 0px 0px;vertical-align:top; width: 150px;", actionButton("conse", "Consent", 
                                                                                                         style=" background-color: #faf0e6; border-color: #faf0e6")),
    div(style="display: inline;padding: 0px 0px 0px 0px;vertical-align:top; width: 150px;", actionButton("rp", "Run Project", 
                                                                                                         style=" background-color: #faf0e6; border-color: #faf0e6")),
    div(style="display: inline;padding: 0px 0px 0px 0px;vertical-align:top; width: 150px;", actionButton("res", "Results", 
                                                                                                         style=" background-color: #faf0e6; border-color: #faf0e6"))
    
  ),
  class = "dropdown")
  
  
)

shinyApp(
  ui = dashboardPagePlus(
    header = dbHeader,
    sidebar = dashboardSidebar(width = "0px",
                               sidebarMenu(id = "sidebar", # id important for updateTabItems
                                           menuItem("Information", tabName = "info", icon = icon("table")),
                                           menuItem("Consent", tabName = "conse", icon = icon("line-chart")),
                                           menuItem("Run Project", tabName = "rp", icon = icon("table")),
                                           menuItem("Results", tabName = "res", icon = icon("line-chart"))
                               )          ),
    body = dashboardBody(
      
      useShinyjs(),
      tags$script(HTML("$('body').addClass('fixed');")),
      
      tags$head(tags$style(".skin-blue .main-header .logo { padding: 0px;}")),
      
      
      
      tabItems(
        
        tabItem("info"
                
        ),
        tabItem("conse"
        ),
        tabItem("rp"),
        tabItem("res"
        )
      )
      
    )
    
  ),
  server<-shinyServer(function(input, output,session) { 
    hide(selector = "body > div > header > nav > a")
    
    
  }
  )
)

mytitle我建议将手动元素对齐替换为shiny的布局功能(参见第二页:)。使用一个
fluidRow
作为标题,另一个带有4列的按钮。我明白了……但是你能提供一个工作示例吗?这不起作用?请澄清。由于某些原因,它会像您在第一个附加屏幕截图中看到的那样显示。谢谢您的帮助。我认为图像比botton中的标题部分大一点。你能看到吗?如何调整?请尝试
边距底部:-78px而不是
页边距底部:-83px。代码更新了。你很好,谢谢你
mytitle <- paste0("Life, Death & Statins")
dbHeader <- dashboardHeaderPlus(
  titleWidth = "0px",
  tags$li(a(
    div(style = "margin-left:-15px;margin-bottom:-78px;margin-top:-15px;padding: 0px 1190px 0px 0px ; width: 290px;",
        img(src = 'UOW.png', height = "155px",width="232px")),
    div(style="display: inline;margin-top:-35px; padding: 0px 50px 0px 700px ;font-size: 44px ;color:#001641;font-family:Chronicle Display Light; width: 500px;",HTML(mytitle)),
    
    div(style="display: inline; margin-top:15px; padding: 0px 0px 0px 700px;vertical-align:top; width: 150px;", actionButton("info", "Information", 
                                                                                                                          style=" background-color: #faf0e6; border-color: #faf0e6")),
    div(style="display: inline;padding: 0px 0px 0px 0px;vertical-align:top; width: 150px;", actionButton("conse", "Consent", 
                                                                                                         style=" background-color: #faf0e6; border-color: #faf0e6")),
    div(style="display: inline;padding: 0px 0px 0px 0px;vertical-align:top; width: 150px;", actionButton("rp", "Run Project", 
                                                                                                         style=" background-color: #faf0e6; border-color: #faf0e6")),
    div(style="display: inline;padding: 0px 0px 0px 0px;vertical-align:top; width: 150px;", actionButton("res", "Results", 
                                                                                                         style=" background-color: #faf0e6; border-color: #faf0e6"))
    
  ),
  class = "dropdown")
  
  
)

shinyApp(
  ui = dashboardPagePlus(
    header = dbHeader,
    sidebar = dashboardSidebar(width = "0px",
                               sidebarMenu(id = "sidebar", # id important for updateTabItems
                                           menuItem("Information", tabName = "info", icon = icon("table")),
                                           menuItem("Consent", tabName = "conse", icon = icon("line-chart")),
                                           menuItem("Run Project", tabName = "rp", icon = icon("table")),
                                           menuItem("Results", tabName = "res", icon = icon("line-chart"))
                               )          ),
    body = dashboardBody(
      
      useShinyjs(),
      tags$script(HTML("$('body').addClass('fixed');")),
      
      tags$head(tags$style(".skin-blue .main-header .logo { padding: 0px;}")),
      
      
      
      tabItems(
        
        tabItem("info"
                
        ),
        tabItem("conse"
        ),
        tabItem("rp"),
        tabItem("res"
        )
      )
      
    )
    
  ),
  server<-shinyServer(function(input, output,session) { 
    hide(selector = "body > div > header > nav > a")
    
    
  }
  )
)