2017-10-08 38 views
1

我想添加selectizeInput()与我的闪亮的应用程序中的标题在一行。此外,我想将标题对齐左侧,并且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

您可以使用这样的事情:

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) 
    )) 
+0

谢谢你,这很好地工作! – Adela