【问题标题】:bottom align a button in R shiny底部对齐R中的按钮闪亮
【发布时间】:2015-05-11 16:22:52
【问题描述】:

我无法找到将downloadButtonselectizeInput 底部对齐的方法,即,

library(shiny)

runApp(list(
  ui = shinyUI(fluidPage(
    fluidRow(align="bottom",
      column(12, align="bottom",
             h4("Download Options:"),
             fluidRow(align="bottom", 
                      column(6, selectizeInput("plot_dl", "File Type", width="100%",  
                                               choices = list("PDF"="pdf","PNG"="png"))),
                      column(3, downloadButton('plot1_dl', 'Left Plot')),
                      column(3, downloadButton('plot2_dl', 'Right Plot'))
             )
      )
    ),
    tags$style(type='text/css', "#plot1_dl { width:100%; vertical-align:bottom}"),
    tags$style(type='text/css', "#plot2_dl { width:100%;}")
  )),
  server = function(input, output) {
  }
))

align="bottom" 放置在任何地方和任何地方都不会引发错误消息,但也不会产生预期的效果。尝试使用按钮的样式标签,但我的深度不够。

【问题讨论】:

    标签: html css r shiny fluid-layout


    【解决方案1】:

    在样式标签中找到了带有margin-top: 25px 的临时修复...

    library(shiny)
    
    runApp(list(
      ui = shinyUI(fluidPage(
         h4("Download Options:"),
         fluidRow(
           column(6, selectizeInput("plot_dl", "File Type", width="100%",
                                    choices = list("PDF"="pdf","PNG"="png"))),
           column(3, downloadButton('plot1_dl', 'Left Plot')),
           column(3, downloadButton('plot2_dl', 'Right Plot'))
         ),
         tags$style(type='text/css', "#plot1_dl { width:100%; margin-top: 25px;}"),
         tags$style(type='text/css', "#plot2_dl { width:100%; margin-top: 25px;}")
      )),
      server = function(input, output) {
      }
    ))
    

    【讨论】:

    • 是的,我建议调查一下,因为选择输入“文件类型”的名称会影响展示位置
    • 当我尝试它时,这似乎对我没有任何影响。但是,我使用的是uiOutput()。这会有所作为吗??
    【解决方案2】:

    其他方法是在列函数中传递style 参数。

    runApp(list(
            ui = shinyUI(fluidPage(
                    h4("Download Options:"),
                    fluidRow(
                            column(6, selectizeInput("plot_dl", "File Type", width="100%",
                                                     choices = list("PDF"="pdf","PNG"="png"))),
                            column(3, style = "margin-top: 25px;", downloadButton('plot1_dl', 'Left Plot')),
                            column(3, style = "margin-top: 25px;", downloadButton('plot2_dl', 'Right Plot'))
                    )
            )),
            server = function(input, output) {
            }
    ))
    

    【讨论】:

      猜你喜欢
      • 2015-04-29
      • 2015-04-26
      • 2017-01-29
      • 2014-06-30
      • 2017-01-24
      • 1970-01-01
      • 2019-07-26
      • 2021-05-01
      • 1970-01-01
      相关资源
      最近更新 更多