2017-10-14 100 views
-1

如何將文本放在文本輸入旁邊?如何在文本輸入旁邊編寫文本?

enter image description here

這是我創建的上述圖片:

library(shiny) 

ui <- fluidPage(
    sidebarLayout(
    sidebarPanel(
     fluidRow(
     column(
      width = 3, 
      div(style = "white-space: nowrap;", 
      textInput(inputId = "txt_ipt", label = "Some label text", 
        value = "", width = 150))), 
     column(
      width = 3, 
      "Move me down"))), 
    mainPanel())) 

server <- function(input, output, session) {} 

shinyApp(ui, server) 

我的目標是寫一些文字(其實只有一個字)旁邊的文字輸入。

回答

1

這應該做的工作,歡迎隨時更改字體大小h5h4和其他

library(shiny) 
ui <- fluidPage(
    sidebarLayout(
    sidebarPanel(
     fluidRow(
     column(
      width = 3, 
      div(style = "white-space: nowrap;", 
       div(style="display: inline-block; width: 100%;",textInput("txt_ipt", label = "Some label text", value = "", width = 150)), 
       h5('Move me down',style="display:inline-block") 

      )))), 
    mainPanel())) 

server <- function(input, output, session) {} 

shinyApp(ui, server) 

enter image description here

1

您可以使用HTML()<br>一起移動文本。喜歡的東西:

library(shiny) 

ui <- fluidPage(
    sidebarLayout(
    sidebarPanel(
     fluidRow(
     column(
      width = 3, 
      div(style = "white-space: nowrap;", 
      textInput(inputId = "txt_ipt", label = "Some label text", 
        value = "", width = 150))), 
     column(
      width = 3, 
      HTML("<br>Move me down")))), 
    mainPanel())) 

server <- function(input, output, session) {} 

shinyApp(ui, server) 
0

露西的回答是不允許精細定位給我帶來了以下解決方案,它:

library(shiny) 

ui <- fluidPage(
    sidebarLayout(
    sidebarPanel(
     fluidRow(
     column(
      width = 3, 
      div(style = "white-space: nowrap;", 
       textInput(inputId = "txt_ipt", label = "Some label text", 
         value = "", width = 150))), 
     column(
      width = 3, 
      tags$div(
      style="margin-top:30px;", 
      "Move me down")))), 
    mainPanel())) 

server <- function(input, output, session) {} 

shinyApp(ui, server)