2017-10-08 36 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