我想将两个宽度相等的动作按钮居中放置在它们之间。所以我尝试了:
library(shiny)
ui <- fluidPage(
fluidRow(
align = "center",
br(),
column(
12,
actionButton(
inputId = "ab1",
label = "Left button",
style = "width:400px"
),
actionButton(
inputId = "ab2",
label = "Right button",
style = "width:400px"
)
) # column
) # fluidRow
) # fluidPage
server <- function(input, output) {}
shinyApp(ui, server)
这给出了:
如何增加两个按钮之间的间距?在Shiny - How to increase spacing between inline radio buttons?之后,我在右键上尝试了style = "width:400px; margin.left:200px"
,但这没有任何效果。
编辑:按照Stephane的建议,我尝试过:
library(shiny)
ui <- fluidPage(
fluidRow(
align = "center",
br(),
column(
6,
actionButton(
inputId = "ab1",
label = "Left button",
style = "width:400px"
)
),
column(
6,
actionButton(
inputId = "ab2",
label = "Right button",
style = "width:400px"
)
)
) # fluidRow
) # fluidPage
server <- function(input, output) {}
shinyApp(ui, server)
但是,现在两个按钮之间的间隔太大:
如何缩小尺寸,i。 e。如何控制?
答案 0 :(得分:1)
您也可以使用splitLayout
:
library(shiny)
ui <- fluidPage(
fluidRow(
align = "center",
br(),
column(
12,
splitLayout(cellWidths = c("30%", "30%"),
actionButton(
inputId = "ab1",
label = "Left button",
style = "width:400px"
),
actionButton(
inputId = "ab2",
label = "Right button",
style = "width:400px"
)
)
)
) # fluidRow
) # fluidPage
server <- function(input, output) {}
shinyApp(ui, server)
答案 1 :(得分:0)
像这样,可以吗?
ui <- fluidPage(
fluidRow(
align = "center",
br(),
column(
6,
actionButton(
inputId = "ab1",
label = "Left button",
style = "width:400px"
)
),
column(
6,
actionButton(
inputId = "ab2",
label = "Right button",
style = "width:400px"
)
)
)
)
server <- function(input, output) {}
shinyApp(ui, server)