3

I'm trying to eliminate the space between this table and the left side of browser window, but when I do, it messes up the spacing of the nav bar links and title.

How can I remove padding/margin on the excelR table, without altering the padding/margin of the navbar/ui/li elements?

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
            )
        )
    }
)

Frank
  • 952
  • 1
  • 9
  • 23

1 Answers1

1

You can simply add this additional css to your code:

     tags$style(type = "text/css", ".navbar{padding-left:15px;
       padding-right:15px ; margin-right:auto; margin-left:auto;}")
      ),

Hope this helps!

SBista
  • 7,479
  • 1
  • 27
  • 58