【问题标题】:Adjust spacing between R Shiny's renderText elements调整 R Shiny 的 renderText 元素之间的间距
【发布时间】:2021-01-18 01:41:43
【问题描述】:

如何调整表格末尾和句子“Place very close to table”之间的间距。

这是默认间距:

这是所需的间距:

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

【问题讨论】:

    标签: css r shiny


    【解决方案1】:

    一种可能性:

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

    【讨论】:

    • 我一直使用fluidPage来布局一个闪亮的页面。您的答案是使用“flex”而不是fluidPage 来强加布局吗?是否有关于何时使用fluidPage 以及何时使用Flex 的一般规则?
    • @ixodid 你的意思是 fluidRowfluidRow 只是具有特定类的 div,旨在包含一些 column 元素。在这里,我在列方向上使用了一个 flexbox 来强制堆叠。我首先认为 flexbox 不是必需的,因为 HTML 元素是“默认”堆叠的,但由于某种原因(肯定是tabBox 的 CSS 属性),这里不是这种情况。
    猜你喜欢
    • 2022-11-21
    • 2019-10-23
    • 1970-01-01
    • 2021-04-05
    • 1970-01-01
    • 2017-01-16
    • 2011-03-17
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多