【问题标题】:How to center text using fluidRow and mainPanel?如何使用fluidRow和mainPanel使文本居中?
【发布时间】:2019-06-21 16:50:34
【问题描述】:

我想将fluidRow 中的一些文本置于mainPanel 中。因此,我尝试了:

library(shiny)

ui <- fluidPage(
  mainPanel(
    fluidRow(
      align = "center",
      "How to center this?"
    )
  )
)

server <- function(input, output) {}

shinyApp(ui, server)

但是,文本明显偏离中心(太左)。如果我省略 mainPanel(...) 它会起作用。

【问题讨论】:

    标签: r shiny


    【解决方案1】:

    它确实居中,mainPanel 只是没有占据全宽。 如果你看?mainPanel(),width的参数默认是8。如果您想要全宽,请将其设置为 12。

    library(shiny)
    
    ui <- fluidPage(
       mainPanel(
          fluidRow(
             align = "center",
             "How to center this?"
          ), width = 12
       )
    )
    
    server <- function(input, output) {}
    
    shinyApp(ui, server) 
    

    【讨论】:

      猜你喜欢
      • 2017-06-03
      • 2020-10-11
      • 2011-09-24
      • 2013-10-12
      • 1970-01-01
      • 1970-01-01
      • 2011-01-27
      • 2016-09-30
      • 2015-07-13
      相关资源
      最近更新 更多