2015-12-02 85 views
-1

我在HTML中有一个背景,它看起来像图片中的附件。 的CSS代码:将下拉文本的颜色更改为黑色

.custom-dropdown{ 
-webkit-appearance: none; 
margin-left:190px; 
-moz-appearance: none; border: 0 !important; 
-webkit-border-radius: 5px; border-radius: 5px; font-size: 14px; 
padding: 10px; width: 35%; cursor: pointer; 
background-size: 40px 37px; 
display:none; 
/* 
color: #fff; 
background: #0d98e8 url('http://www.kevinfremon.com/wp-content/uploads/2013/11/drop-down-arrow.png') no-repeat right center; 
*/ 
background: #e2e2e2 url('http://www.kevinfremon.com/wp-content/uploads/2013/11/drop-down-arrow.png') no-repeat right center ; 
color: #fff; 

} 

的HTML是:

<select id= "dropdownlist" class="custom-dropdown"> 
    <option>Custom Key</option> 
    <option>test</option> 
    </select> 

现在我想使文本这些下拉列表中出现inblack的(“自定义键”)(不改变背景颜色因为它与我的模板一起)。 我该如何做到这一点?在.custom-dropdown

enter image description here

+0

'color:#000000'? – Pete

+0

http://stackoverflow.com/search?q=%5BCSS%5D+style+select – HerrSerker

回答

4

更改颜色属性从color:#fffcolor:#000

.custom-dropdown { 
 
    -webkit-appearance: none; 
 
    margin-left: 190px; 
 
    -moz-appearance: none; 
 
    border: 0 !important; 
 
    -webkit-border-radius: 5px; 
 
    border-radius: 5px; 
 
    font-size: 14px; 
 
    padding: 10px; 
 
    width: 35%; 
 
    cursor: pointer; 
 
    background-size: 40px 37px; 
 
    color: #000; 
 

 
    background: #e2e2e2 url('http://www.kevinfremon.com/wp-content/uploads/2013/11/drop-down-arrow.png') no-repeat right center; 
 
}
<select id="dropdownlist" class="custom-dropdown"> 
 
    <option>Custom Key</option> 
 
    <option>test</option> 
 
</select>

+0

谢谢,这工作:) 将其标记为回答10分钟! –

0

只需添加这

color: black; 

,并删除该

color: #fff; 
相关问题