Bootstrap <option> rgba颜色

时间:2015-12-03 17:35:20

标签: jquery html css twitter-bootstrap

我越来越痴迷于试图解决这个问题,我希望有人可以帮我解决这个问题。目前,我有一个使用bootstrap的表单。我可以为rgba标记应用select颜色,但我无法使用选项。

以下是我选择的CSS的样子:

select {
    background-color: rgba(0,0,0,0.25) !important;
    border: 1px solid rgba(255,255,255,0.25) !important;
    color: #fff !important;
    min-height: 30px !important;
    padding-right: 6px !important;
    transition: border 0.2s linear 0s, box-shadow 0.2s linear 0s !important;

}

这就是它的样子:

enter image description here

现在,这是我目前对选项标签的内容:

选项CSS:

select option {
            width: 100%;
    background-color: rgba(0,0,0,0.35) !important;

          -webkit-appearance: none;            /*Removes default chrome and safari style*/
      -moz-appearance: none;             /* Removes Default Firefox style*/
}

这就是它的样子:

enter image description here

我使用ulli重新创建了相同的内容:

ul.dropdown{ 
    display: block;
    position: relative;
    width: 100%;
    height: 34px;
    font-size: 14px;
    line-height: 1.42857143;
    background-color: rgba(0,0,0,0.25) !important;
    border: 1px solid rgba(255,255,255,0.25) !important;
    -webkit-box-shadow: inset 0 1px 1px rgba(0,0,0,.075);
    box-shadow: inset 0 1px 1px rgba(0,0,0,.075);
    -webkit-transition: border-color ease-in-out .15s,-webkit-box-shadow ease-in-out .15s;
    -o-transition: border-color ease-in-out .15s,box-shadow ease-in-out .15s;
    transition: border-color ease-in-out .15s,box-shadow ease-in-out .15s;
}
ul.dropdown ul {
    width: 100%;
    background-color: rgba(0,0,0,0.35) !important;
    visibility: hidden; 
    position: absolute;
    list-style-type: none;
    top: 100%;
    left: 0; 
    padding: 0px;
}

我希望select /选项看起来像这样:

enter image description here

问题:

1) Bootstrap或Chrome中是否有默认的背景设置,当应用RGBA时,它会覆盖它,如果是这样,我该如何删除它看起来像ul / li设计?

2)是否有一个jquery插件可以应用于ul / li来模拟选择/选项功能?

我发现的所有内容都使用select / option并且造型有限而且我担心Bootstrap的样式可能会干扰

感谢您的帮助。

1 个答案:

答案 0 :(得分:1)

Bootstrap将.dropdown-menu类应用于转换为ul的选择。所以你可以简单地覆盖那个类。

ul.dropdown-menu
{
  background-color: brown;
}

ul.dropdown-menu li a:hover
{
 background-color: orange; 
}

示例:http://jsfiddle.net/dJDHd/1365/

相关问题