如何将文本放在文本输入的旁边?

我就是这样创建上面的图片的:
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)我的目标是在文本输入旁边写一些文本(实际上只有一个单词)。
发布于 2017-10-16 10:20:30
这应该可以完成这项工作,可以随意地将字体大小从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)

发布于 2017-10-14 17:00:42
您可以使用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)发布于 2017-10-14 17:09:56
露西的回答不允许精确定位,这给我带来了以下解决方案:
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)https://stackoverflow.com/questions/46746437
复制相似问题