将vertical-align:top 添加到您的style
rm(list = ls())
library(shiny)
ui <- fluidPage(
sidebarPanel(
div(style="display: inline-block;vertical-align:top; width: 150px;",selectInput("ddllgra", "Function:",c('mean','median','sd','count','min','max'), selected='mean')),
div(style="display: inline-block;vertical-align:top; width: 150px;",textInput(inputId="xlimitsmax", label="x-max", value = 0.5))),
mainPanel()
)
server <- shinyServer(function(input,output){})
shinyApp(ui, server)
编辑:如何在 div 之间添加空格
您可以使用相同的方法:下面的示例在 div 之间有 100px
rm(list = ls())
library(shiny)
ui <- fluidPage(
sidebarPanel(
div(style="display: inline-block;vertical-align:top; width: 150px;",selectInput("ddllgra", "Function:",c('mean','median','sd','count','min','max'), selected='mean')),
div(style="display: inline-block;vertical-align:top; width: 100px;",HTML("<br>")),
div(style="display: inline-block;vertical-align:top; width: 150px;",textInput(inputId="xlimitsmax", label="x-max", value = 0.5))),
mainPanel()
)
server <- shinyServer(function(input,output){})
shinyApp(ui, server)