代码之家  ›  专栏  ›  技术社区  ›  ixodid

调整R Shiny的renderText元素之间的间距

  •  0
  • ixodid  · 技术社区  · 4 年前

    如何调整表格末尾和句子“放得离表格很近”之间的间距。

    以下是默认间距: enter image description here

    以下是所需的间距: enter image description here

    R Script
    library("shiny")
    library("shinydashboard")
    
    shinyApp(
      ui = dashboardPage(
        dashboardHeader(disable = TRUE),
        dashboardSidebar(width = 0),
    
        body <- dashboardBody(
          fluidRow(
            tabBox(
              id = "tabset1", height = "250px",
              tabPanel("Tab1", "First tab content"),
              tabPanel("Tab2", "Tab content 2")
            ),
           
          ),
          fluidRow(htmlOutput("last_updated"))
        )
      ),
      server = function(input, output) {
        # The currently selected tab from the first box
        output$tabset1Selected <- renderText({
          input$tabset1
        })
        
        output$last_updated <- renderText({
          paste("<font size='1px;'>&ensp;&ensp;Place very close to table</font>") 
        })
      }
    )
    
    1 回复  |  直到 4 年前
        1
  •  2
  •   Stéphane Laurent    4 年前

    一种可能性:

    body <- dashboardBody(
      div(
        style = "display: flex; flex-direction: column;",
        tabBox(
          id = "tabset1", height = "250px",
          tabPanel("Tab1", "First tab content"),
          tabPanel("Tab2", "Tab content 2")
        ),
        div(style = "margin-top: -20px;"),
        htmlOutput("last_updated")
      )
    )
    
    推荐文章