[英]R, Shiny : Inline selectInput
1)如何将selectInput
在selectInput
旁边? 我试过了 :
# style.css
.general {
display: inline-block;
margin-left: auto;
margin-right: auto;
height: auto;
width : auto ;
white-space: nowrap ;}
# ui.R
...
tags$div(class = "general", selectInput(...), selectInput(...))
...
但这不起作用。
2)我们如何将selectInput
的标签selectInput
在selectInput
本身旁边? 我在标题旁边找到了定位闪亮的小部件的主题,但这是为应用程序的所有selectInput
设计的。 我没有设法仅在我的应用程序的一个selectInput
中使用tags$style(...)
提供的tags$style(...)
,而不是全部使用。 我们该怎么做?
谢谢。
只需尝试使用一个流体行和几列。 由于流体行的总宽度= 12,因此您可以连续放置多达12列,而无需任何其他CSS。 例如:
fluidRow(
column(6, selectInput("S1", label = "S1")),
column(6, selectInput("S2", label = "S2"))
)
我用一个简单的例子回答我对问题1)的回答:
# style.css
.divleft {
float : left;
width : 50%;
}
.clearl {
clear: left;
}
# ui.R
library(shiny)
shinyUI(fluidPage(
tagList(
tags$head(
tags$link(rel="stylesheet", type="text/css",href="style.css")
)
),
sidebarLayout(
sidebarPanel(
selectInput("s1", "Select 1", 1:10),
tags$div(
tags$div(class = "divleft", selectInput("s2", label = "Select 2", 1:5, width = validateCssUnit("70%"))),
tags$div(class = "divleft", selectInput("s3", label = "Select 3", 1:5, width = validateCssUnit("70%")))
),
tags$div(class = "clearl",
selectInput("s4", "Select 4", 1:5)
)
, width = 3),
mainPanel(
h3("Example")
)
)
)
)
# server.R
shinyServer(function(input, output, session) { })
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.