html - 将下拉文本的颜色更改为黑色

标签 html css drop-down-menu background

我有一个 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>

现在我想让这些下拉列表的文本(“自定义键”)显示为黑色(不改变背景颜色,因为它与我的模板一样)。 我怎样才能做到这一点?

enter image description here

最佳答案

.custom-dropdown 类中的颜色属性从 color:#fff 更改为 color:#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>

关于html - 将下拉文本的颜色更改为黑色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34044184/

相关文章:

javascript - CSS/JS : Placing a toolbar on the left side of the screen without overlapping with existing page elements

HTML/CSS dropright 子菜单项与页面背景上的文本重叠(未正确呈现)

css - 目标 svg 动画 "dur"属性与 css

javascript - 如何根据高度过滤元素以适合容器

CSS 菜单向下滑动

html - 负边距、z-index 和点击屏蔽

html - 无法在 li 伪元素上创建框阴影

jQuery UI(切换)下拉菜单与其他菜单重叠

css - 在移动设备上完全展开下拉菜单,但在 Wordpress 的桌面上不展开

python - Jinja - 是否有任何内置变量来获取当前 HTML 页面名称?