2017-05-09 55 views
0

我使用閃亮的儀表板嘗試和學習它閃亮調節鈕的位置

我已經創建了以下(由於保密去除出頭)的腳本,使選擇標準日期,國家和過程按鈕用它旁邊的下載按鈕

不幸的是,進程按鈕並未真正居中在其他對象下。有沒有一種方法可以將流程按鈕向右推到幾個像素?

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 
) 

回答

1

嘗試添加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;}") 

) 

可以調節寬度,以確保按鈕具有相同的長度/寬度

+0

太謝謝你了。你知道我可以用什麼材料來閱讀光面的HTML一面嗎? –

+1

np!有一些教程http://shiny.rstudio.com/articles/html-tags.html https://shiny.rstudio.com/articles/tag-glossary.html,但我在這裏瞭解到的大部分有用的技巧:) – timfaber