如何对齐文本输入旁边的按钮?

时间:2020-12-19 01:22:28

标签: r shiny

我正在尝试将 actionButton 对齐到文本框旁边。

有没有办法向 column 函数添加参数?或者是否有简单的 css 解决方法?

代码:


library(shiny)

ui <- fluidPage(

      sidebarLayout(
        sidebarPanel(),
        
        mainPanel(
            fluidRow(
                column(11, textInput("code", label = " ", width = "100%")),
                column(1, actionButton("run", "Run")))
        )
    )
)
server <- function(input, output) {

}

shinyApp(ui = ui, server = server)

Right now it looks like this:

enter image description here

但我想实现这样的目标:

enter image description here

1 个答案:

答案 0 :(得分:2)

尝试margin-top,如下所示。

library(shiny)

ui <- fluidPage(
  
  sidebarLayout(
    sidebarPanel(),
    
    mainPanel(
      fluidRow(
        column(11, textInput("code", label = " ", width = "100%")),
        column(1, div( style = "margin-top: 20px;", actionButton("run", "Run"))))
    )
  )
)
server <- function(input, output) {
  
}

shinyApp(ui = ui, server = server)

output