r - 难以减少闪亮应用程序中元素之间的边距
问题描述
我正在尝试减少这个闪亮应用程序上两个元素之间的边距。在浏览器中打开时,两者之间的空白是巨大的。
我尝试通过添加style = "margin:0px; padding:0px"
到 UI 来设置 css,但它没有帮助。我也试过弄乱inline = TRUE
设置,也没有帮助。
ui <- fluidPage(
fluidRow(
column(width = 3,
htmlOutput("select1", inline = TRUE, style = "margin:0px; padding:0px")
),
column(width = 3,
htmlOutput("select2", inline = TRUE, style = "margin:0px; padding:0px")
),
column(width = 6)
)
)
server <- function(input, output, session) {
output$select1 <- renderUI({
pickerInput(
inputId = "select1",
label = "LETTERS",
#choices = sort(unique(inventory$SubDivision)),
choices = LETTERS,
options = list(
"actions-box" = TRUE,
size = 10,
`live-search`=TRUE
),
multiple = TRUE
)
})
output$select2 <- renderUI({
pickerInput(
inputId = "select2",
label = "letters",
#choices = sort(unique(inventory$SubDivision)),
choices = letters,
options = list(
"actions-box" = TRUE,
size = 10,
`live-search`=TRUE
),
multiple = TRUE
)
})
}
shinyApp(ui, server)
解决方案
这里的问题不是边距或填充,而是宽度限制为 300 像素。要允许控件增长到列的完整大小,您可以更改全局样式:
ui <- fluidPage(
fluidRow(
tags$head(
tags$style(HTML("
.shiny-input-container:not(.shiny-input-container-inline) {
width:100%;
}"))
),
column(width = 3,
htmlOutput("select1", inline = TRUE)
),
column(width = 3,
htmlOutput("select2", inline = TRUE)
),
column(width = 6)
)
)
推荐阅读
- r - R - 修正间隔数据中的夏令时问题
- javascript - 从数组中获取自己日期之后的最小日期
- powershell - Powershell - Office 365 安全性和合规性
- python - ValueError: 时间数据 '(datetime.datetime(2018, 8, 21, 14, 14, 18, 233000),)' 与格式 '%Y-%m-%d' 不匹配
- javascript - 如何逃避内部css?
- javascript - sum(2)(3) 和 sum(2, 3) 两者的共同解决方案是什么
- django - 如何将 ImageField 中的图像放在 django 中的 html 电子邮件模板上
- maven - 如何使 mvnw 在 Spring Boot 应用程序中包含本地专有代码
- javascript - 带有输入值选项的 HTML 选择表单不会将输入的值存储为 django 中的对象字段
- angular - Angular 8 - 打印 http 响应正文