html - 选择 Shiny 的输入样式

标签 html css r shiny

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

enter image description here

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

enter image description here

我试图更改我的 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())
    )
)

最佳答案

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

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

关于html - 选择 Shiny 的输入样式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37386534/

相关文章:

html - 垂直居中,高度可变

javascript - 如何像gmail一样实现 "pop down"

javascript - 滚动时移动图像

jquery - 如何同时实现 bootstrap Tabs 和 Collapse menu?

R ggplot - 无法分配大向量

r - 子集列表,保留名称

html - 如何设置 Oracle SQL 输出表的样式?

javascript - 创建一个执行 python 脚本的超链接(或按钮),然后在脚本完成时重定向

css - 带有 float 的溢出和清除样式的效果

r - 如何在R中从GIS服务器获取数据?