如何减少 selectinput 中 label 和 choices 之间的 space?
How to reduce space between label and choices in selectinput?
我想 remove/reduce 在 Shiny 中选择输入的标签和选择选项之间的 space。我还想减少两个不同选择输入之间的 space。
我尝试将 selectinputs 包装成 div 样式并将边距和填充设置为 0。这没有效果,但我可能做错了。请参阅下面的代码。
ui <- fluidPage(
theme = shinytheme("sandstone"),
sidebarLayout(
sidebarPanel(
div(style = "font-size:12px; margin: 0px; padding: 0px",
selectInput(
"select1",
label = h5("Selection 1"),
choices = c("a", "b", "c"),
selectize = TRUE
),
selectInput(
"select2",
label = h5("Selection 2"),
choices = c("a", "b", "c"),
selectize = TRUE
)
)
),
mainPanel(
)
)
)
server <- function(input, output, session) {}
shinyApp(ui, server)
这是 link 关于
Shiny - 将下拉菜单(select 标签)的大小(填充?)改小
要减少标签和下拉列表之间的 space,请使用此 CSS:
.shiny-input-container > label {margin-bottom: -15px;}
要减少两个 select 输入之间的 space,您可以在它们之间插入一个带有负 margin-top
样式的 div
。
library(shiny)
library(shinythemes)
css <- "
.shiny-input-container > label {margin-bottom: -15px;}"
ui <- fluidPage(
theme = shinytheme("sandstone"),
tags$head(
tags$style(HTML(css))
),
sidebarLayout(
sidebarPanel(
selectInput(
"select1",
label = h5("Selection 1"),
choices = c("a", "b", "c"),
selectize = TRUE
),
div(style = "margin-top:-15px"),
selectInput(
"select2",
label = h5("Selection 2"),
choices = c("a", "b", "c"),
selectize = TRUE
)
),
mainPanel(
)
)
)
server <- function(input, output, session) {}
shinyApp(ui, server)
我想 remove/reduce 在 Shiny 中选择输入的标签和选择选项之间的 space。我还想减少两个不同选择输入之间的 space。
我尝试将 selectinputs 包装成 div 样式并将边距和填充设置为 0。这没有效果,但我可能做错了。请参阅下面的代码。
ui <- fluidPage(
theme = shinytheme("sandstone"),
sidebarLayout(
sidebarPanel(
div(style = "font-size:12px; margin: 0px; padding: 0px",
selectInput(
"select1",
label = h5("Selection 1"),
choices = c("a", "b", "c"),
selectize = TRUE
),
selectInput(
"select2",
label = h5("Selection 2"),
choices = c("a", "b", "c"),
selectize = TRUE
)
)
),
mainPanel(
)
)
)
server <- function(input, output, session) {}
shinyApp(ui, server)
这是 link 关于 Shiny - 将下拉菜单(select 标签)的大小(填充?)改小
要减少标签和下拉列表之间的 space,请使用此 CSS:
.shiny-input-container > label {margin-bottom: -15px;}
要减少两个 select 输入之间的 space,您可以在它们之间插入一个带有负 margin-top
样式的 div
。
library(shiny)
library(shinythemes)
css <- "
.shiny-input-container > label {margin-bottom: -15px;}"
ui <- fluidPage(
theme = shinytheme("sandstone"),
tags$head(
tags$style(HTML(css))
),
sidebarLayout(
sidebarPanel(
selectInput(
"select1",
label = h5("Selection 1"),
choices = c("a", "b", "c"),
selectize = TRUE
),
div(style = "margin-top:-15px"),
selectInput(
"select2",
label = h5("Selection 2"),
choices = c("a", "b", "c"),
selectize = TRUE
)
),
mainPanel(
)
)
)
server <- function(input, output, session) {}
shinyApp(ui, server)