【问题标题】:Changing css params of a dropdownButton from shinyWidgets从 shinyWidgets 更改下拉按钮的 css 参数
【发布时间】:2020-04-06 05:13:08
【问题描述】:

我从 shinyWidgets 包中设计了一个简单的下拉按钮。不知何故,我无法更改小部件的 css 参数。

dropdownButton( icon = icon('info'), size = 'sm', right = T, up = F, width = '400px',
              div('my text', style = 'font-size:10px'))

我已经尝试按照这里链接的css调整shinywidget dropdownButton CSS tag

然而,这只改变了弹出窗口的参数。

我试图检查元素并找到 css 代码但徒劳无功。

理想情况下,我需要更改按钮的大小、背景颜色和不透明度。

谢谢

【问题讨论】:

    标签: r shiny


    【解决方案1】:

    希望这会有所帮助,请参阅此 SO 链接 #1,'status' 参数可让您设置自定义类(请参阅 this)。在 tags$style 中,您可以使用 'background-color' 选择背景颜色,使用 'opacity' 选择不透明度。 'size' 参数允许您选择按钮的大小。

    dropdownButton(status = "dropdownbutton", icon = icon('info'), size = "lg", right = T, up = F, width = '400px',
                    div('my text', style = 'font-size:10px')
                   ),
    tags$head(tags$style(
      "
      .btn-dropdownbutton{
                          background-color: #393D3F !important;
                          border: solid; border-radius: 4px; border-width: 1px; border-color:#339FFF;
                          color: #339FFF; text-align: center; font-weight:bold; font-size: 12px;
                          opacity: 0.5 !important;
        }
      "
    

    【讨论】:

    • 我无法更改按钮的大小 + 字体大小(如果没有图标)。某些参数(例如宽度/高度/填充)似乎不起作用。
    • 你还在用圆形按钮吗?
    猜你喜欢
    • 2019-07-22
    • 2017-12-29
    • 2020-10-14
    • 2015-08-06
    • 2019-06-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-05-07
    相关资源
    最近更新 更多