【发布时间】:2019-05-06 02:04:03
【问题描述】:
我正在尝试以水平形式垂直对齐输入及其标签。我不确定是否可以垂直对齐不同高度的内联 div。
下面的代码给了我以下信息:
我希望标签与输入保持一致。
library(shiny)
library(shinyWidgets)
library(shinydashboard)
ui <- fluidPage(
column(width = 8,
tabBox(width = 12,
tabPanel(
'Items',
fluidRow(
style = 'margin:2px',
wellPanel(
tags$form(class = 'form-horizontal',
tags$b('Filter items'),
tags$div(
class = 'form-group',
tags$label(class = "col-sm-3 control-label", `for` = 'type', "By type:"),
column(
width = 9,
pickerInput(
inputId = 'type', label = '',
choices = character(0),
multiple = T
))),
tags$div(
class = 'form-group',
tags$label(class = "col-sm-3 control-label", `for` = 'name', "By name:"),
column(
width = 9,
searchInput(
inputId = 'name', label = '',
placeholder = "Search by name",
btnSearch = icon("search"),
btnReset = icon("remove")
))
)
)
)
)
)
)
) #/column 8
)
server <- function(input, output, session) {}
shinyApp(ui, server)
除了column(width = 3, ...)之外我尝试过的:
- 弹性:
tags$div(class = 'form-group', style = 'display:flex; align-items:center;', ...) - 职位:
tags$div(class = 'form-group', style = 'display:table; position:absolute;', tags$label(class = "col-sm-3 control-label", style = 'display;table-cell; vertical-align:middle;', ...), ...)。
我不精通 HTML,所以需要大量猜测。达到预期结果的最佳方法是什么?任何帮助将不胜感激。
【问题讨论】: