我正在使用 Shiny Dashboard 来尝试学习它
我创建了下面的脚本(由于保密原因删除了一些内容),其中给出了选择标准日期、国家/地区和一个进程按钮,旁边有一个下载按钮
不幸的是,进程按钮并没有真正位于其他对象下方的中心。有没有一种方法可以让我将进程按钮向右推几个像素?
library(shinydashboard)
header <- dashboardHeader(title = "Some Header")
sidebar <- dashboardSidebar(br(),title = "Selection Options",
uiOutput("choose_daterange"),
uiOutput("choose_ctry"),
br(),
actionButton("run_report", "Process", icon = icon("refresh")),
actionButton("download", "Download", icon = icon("download"))
)
body <- dashboardBody("Hello World")
# Pulling it all together
dashboardPage(
skin = "yellow",
header,
sidebar,
body
)
最佳答案
尝试在代码中添加 html 样式标签:
sidebar <- dashboardSidebar(br(),title = "Selection Options",
uiOutput("choose_daterange"),
uiOutput("choose_ctry"),
br(),
actionButton("run_report", "Process", icon = icon("refresh")),
actionButton("download", "Download", icon = icon("download")),
tags$style(type='text/css', "#run_report { width:50%; margin-left: 5px;}")
)
您可以调整宽度以确保按钮的长度/宽度相等
关于r - 侧栏中 Shiny 的调整按钮位置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43872859/