我想将两个宽度相等的操作按钮居中,并在它们之间留出一些空间。所以我尝试:
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)
Run Code Online (Sandbox Code Playgroud)
这给出:
如何增加两个按钮之间的间距?关注Shiny - 如何增加内联单选按钮之间的间距?我尝试style = "width:400px; margin.left:200px"了右键,但这没有任何效果。
编辑:根据斯蒂芬的提议,我尝试了:
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)
Run Code Online (Sandbox Code Playgroud)
然而,现在两个按钮之间的空间太大了:
如何让它变得更小,即如何控制它?
您还可以使用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)
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
5939 次 |
| 最近记录: |