【问题标题】:Selectize Input style in shiny选择闪亮的输入样式
【发布时间】:2016-05-23 17:34:59
【问题描述】:

我正在尝试在shiny 中自定义我的selectize input。我所拥有的是:

我想要的是改变所选项目的颜色,如下所示:

我尝试更改我的css,但我设法通过添加以下内容仅更改了这个“a”颜色:

.selectize-input.input-active, .selectize-input.input-active:hover, .selectize-control.multi .selectize-input.focus {border-color: #2196f3 !important;}
.selectize-dropdown .active {background: #2196f3 !important;}

我也想改变“c”和“b”的颜色,但我不知道怎么做。你能帮帮我吗?

我的代码:

server.R:

library("shiny")

shinyServer(function(input, output){})

ui.R:

library("shiny")

shinyUI(fluidPage(
    sidebarLayout(
        sidebarPanel(
            selectizeInput("select", label=NULL,
                           choices=c("a", "b", "c", "d"),
                           multiple=TRUE, options=list(placeholder="Wybierz"))),
        mainPanel())
    )
)

【问题讨论】:

    标签: html css r shiny


    【解决方案1】:

    这是否有效(在fluidPage 之后和sidebarLayout 之前)?

    tags$head(
      tags$style(HTML("
         .item {
           background: #2196f3 !important;
           color: white !important;
         }
         .selectize-dropdown-content .active {
           background: #2196f3 !important;
           color: white !important;
         }
      "))
    ),
    

    【讨论】:

    • 谢谢!这样可行。你知道要添加什么来改变字体颜色吗?
    • 我已将其更新为还包括 color = white 但您可以在其中添加任何有效的 css 颜色
    • 太棒了!为什么需要这个!important?也许这是基本的,但我对 html 很陌生......
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-07-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-03-16
    • 2020-08-01
    相关资源
    最近更新 更多