[英]Extra line between fileInput and checkboxInput in R Shiny
看起来Shiny中的fileInput和checkboxInput之间有多余的空间(即使我没有添加额外的行)。 我如何摆脱多余的线条? 谢谢!
if (interactive()) {
ui <- fluidPage(
sidebarLayout(
sidebarPanel(
fileInput("file1", "Choose CSV File",
accept = c(
"text/csv",
"text/comma-separated-values,text/plain",
".csv")
),
checkboxInput("header", "Header", TRUE)
),
mainPanel(
tableOutput("contents")
)
)
)
server <- function(input, output) {
output$contents <- renderTable({
inFile <- input$file1
if (is.null(inFile))
return(NULL)
read.csv(inFile$datapath, header = input$header)
})
}
shinyApp(ui, server)
}
好吧,这是进度栏的空间。 您可以使用CSS删除周围元素的边距,方法是加载软件包shinyjs
并将其插入到UI中的任意位置:
inlineCSS(list(".shiny-input-container" = "margin-bottom: 0px",
"#file1_progress" = "margin-bottom: 0px",
".checkbox" = "margin-top: 0px"))
或者,如果您想在不使用额外程序包的情况下执行本机CSS:
tags$style(".shiny-input-container {margin-bottom: 0px} #file1_progress { margin-bottom: 0px } .checkbox { margin-top: 0px}"),
提示:右键单击要删除的空间,然后选择“检查元素”。 然后,您将看到该空间属于HTML的哪个节点。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.