如何在fluidRow列中定位按钮

时间:2016-09-05 17:49:25

标签: css r shiny

我正试图在selectInput旁边的actionButton框中使用fluidRow& column个论点。但是按钮会放在column的顶部。 使用text-align:center中的div将按钮置于column视图的中心位置。我希望actionButton与其左侧的selectBox处于同一高度。

由于CSS我刚刚开始进入某些Shiny,但我在这里不知所措。 在此先感谢:)

ui <- fluidPage(title = "Working Title",

sidebarPanel(width = 6,
# *Input() functions
fluidRow(column(6, selectInput("Input1", label = h3("Select Input 1"), choices = list( "A" = "A", "B" = "B"), selected = 1)),
        column(6, div(style = "background-color:yellow; text-align:center;", actionButton("goButtonSetInput1", "SetInput1")))
        )
   )

)

server <- function(input, output) {

}

shinyApp(ui = ui, server = server)

1 个答案:

答案 0 :(得分:3)

您可以通过添加另一个fluidRow并设置label = NULL

来实现
ui <- fluidPage(title = "Working Title",

                sidebarPanel(width = 6,
                             # *Input() functions
                             fluidRow(column(6,  h3("Select Input 1") )), 
                             fluidRow(column(6, selectInput("Input1", label = NULL, choices = list( "A" = "A", "B" = "B"), selected = 1)),
                                      column(6, div(style = "background-color:yellow; text-align:center;", actionButton("goButtonSetInput1", "SetInput1")))
                             )
                )

)

server <- function(input, output) {

}

shinyApp(ui = ui, server = server)