将actionButton上titlePanel的右侧有光泽

问题描述 投票:1回答:1

我建立这个UI一个闪亮的应用程序。这里是nhl-logo.png

enter image description here

ui <- fluidPage(

  titlePanel(tagList(
    img(src = "nhl-logo.png", height = 60, width = 60),
    "PLAY-BY-PLAY"),
    windowTitle = "NHL Play-by-Play"),

  div(style = "position:absolute;right:2em;", 
      actionButton('load_inputs', 'Load inputs'),
      actionButton('save_inputs', 'Save inputs')
  ),

  hr(),

  fluidRow(...)

不幸的是,style是不是我想要的,因为它把上比标题较低级别的actionButtons(NHL LOGO PLAY-BY-PLAY)

enter image description here

如何改变style让我actionButtons出现在同一水平的titlePanel

html css r shiny
1个回答
0
投票

您可以在span其中包括按钮添加标题。一个spandiv之间的区别是,span是内联(一个div是一个块)。

ui <- fluidPage(
  titlePanel(tagList(
    img(src = "nhl-logo.png", height = 60, width = 60),
    span("PLAY-BY-PLAY", 
         span(actionButton('load_inputs', 'Load inputs'),
              actionButton('save_inputs', 'Save inputs'), 
              style = "position:absolute;right:2em;")
    )
  ),
  windowTitle = "NHL Play-by-Play"
  ),
  hr(),
  fluidRow()
)

server <- function(input, output, session) {
}

shinyApp(ui, server)
© www.soinside.com 2019 - 2024. All rights reserved.