我试图消除此表和浏览器窗口左侧之间的空格,但是当我这样做时,它会弄乱导航栏链接和标题的间距。
如何在不更改导航栏/ui/li 元素的填充/边距的情况下删除 excelR 表上的填充/边距?
library(shiny)
library(excelR)
shinyApp(
ui = navbarPage("title", selected = "main",
position = "fixed-top",
tags$style(type="text/css", "body {padding-top: 70px;}"),
tags$head(
tags$style(
"body {overflow-y: hidden;}"
)
),
tags$head(
tags$style(type = "text/css", ".container-fluid {padding-left:0px;
padding-right:0px; margin-right:0px; margin-left:0px;}")
),
tabPanel("main", id = "main",
fluidPage(
excelOutput("table", width = "100%", height = "1000px")
#htmlOutput("table", width = "100%", height = "500px")
)
)
),
server = function(input, output, session) {
output$table <-renderExcel(
excelTable(
data = iris,
autoColTypes = FALSE,
autoFill = TRUE,
fullscreen = FALSE,
lazyLoading = TRUE,
search = TRUE,
tableHeight = "800px",
pagination <- NULL
)
)
}
)
您可以简单地将这个额外的 css 添加到您的代码中:
tags$style(type = "text/css", ".navbar{padding-left:15px;
padding-right:15px ; margin-right:auto; margin-left:auto;}")
),
希望这有帮助!