如何将文字放在文字输入旁边?
这就是我创建上述图片的方式:
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)
我的目标是在文本输入旁边写一些文本(实际上只有一个单词)。
答案 0 :(得分: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)
答案 1 :(得分:1)
这应该可以胜任,随时可以将字体大小从h5
更改为h4
和其他人
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)
答案 2 :(得分:0)
Lucy的答案不允许精确定位,这使我得到了以下解决方案:
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)