【发布时间】:2021-01-20 01:10:49
【问题描述】:
这是一个大致位于页面中心的 Shiny 表格。可以看到here。
library(shiny)
library(reactable)
df <- mtcars[1:4, 1:3]
ui <- fluidPage(
h4("Here is a heading"),
fluidRow(
column(3, align="center"),
reactableOutput("table"))
)
server <- function(input, output, session) {
output$table <- renderReactable({
reactable(df,
fullWidth = FALSE)
})
}
shinyApp(ui, server)
如果我从 iframe 链接到这个 Shiny 应用程序,中心会消失,如 here 所示。
<!DOCTYPE html>
<html>
<body>
<div >
<iframe src="https://whatbank.ca/tmp" width=500; height=1000; style="margin-bottom: 1px;" frameborder="0" >
</iframe>
</div>
</body>
</html>
- 如何在 iframe 中保持居中?
- 这是
column(3, align="center"),使表格居中的正确方法吗?
【问题讨论】:
-
为了使表格居中,我会这样做
fluidRow(column(12, align="center", reactableOutput("table")))。 -
是的,在我给出的示例中有效。不幸的是,你无法读懂我的想法并意识到我想要的是一个 tabBox 的解决方案,它位于 ui = dashboardPage(...