标题内联selectizeInput

时间:2017-10-08 19:40:11

标签: html css r shiny

我想将selectizeInput()添加到我的闪亮应用中的标题的一行中。此外,我想将标题左侧与selectizeInput()对齐。

我试过了:

shinyUI(fluidPage(
  theme = shinytheme("simplex"),
  titlePanel(title = div(div(style = "display: inline-block; ",
                             "My shiny application"),
                         div(style = "width: 200px; display: inline-block; 
                                      float: right; ",
                             selectInput(inputId = "opt",
                                         label = "",
                                         choices = c("opt1", "opt2", "opt3"),
                                         selected = "opt1")))),

  sidebarLayout(
    sidebarPanel(),
    mainPanel(),
    fluid = F)
))

但标题和selectInput()不在同一行。当我排除float: right时,它们是,但它们没有正确对齐。

欢迎任何建议!

1 个答案:

答案 0 :(得分:1)

您可以使用以下内容:

 shinyUI(fluidPage(
      theme = shinytheme("simplex"),
      tagList(div(div(style = "display: inline-block; ",
                                 h1("My shiny application"),class="main_title"),
                             div(style = "width: 200px; display: inline-block; 
                                          float: right; ",
                                 selectInput(inputId = "opt",
                                             label = "",
                                             choices = c("opt1", "opt2", "opt3"),
                                             selected = "opt1")))),

      sidebarLayout(
        sidebarPanel(),
        mainPanel(),
        fluid = F)
    ))