html - 如何在 IE 中删除选择选项时的白色背景

标签 html css internet-explorer

我有一个用于选择性别及其黑色背景的选择框。当我在 IE 中选择一个选项时,它会添加一个白色背景,如下所示:

enter image description here

我添加了以下样式规则来删除这种颜色,但它不起作用。

select:focus::-ms-value {
    background-color: #111118;
}

我这里不需要任何背景颜色,它应该如下图所示:

enter image description here

不确定为什么它只发生在 IE 上。如何解决这个问题?

最佳答案

尝试了以下样式,效果很好

select {
    background-color: #000;
    border: 0px;
    border-bottom: 1px solid gray;
    color: grey;
  }

  select::-ms-expand {
    display: none;
  }

select:focus::-ms-value {
    background-color: #000;
}

参见 plnkr

在您的来源中查找冲突的样式。

关于html - 如何在 IE 中删除选择选项时的白色背景,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52665367/

相关文章:

html - Firefox 不在本地加载字体子文件夹

html - 将django表单中的外键字段设置为只读,并且仍然允许提交表单

javascript - Angular 分量中的对齐问题(CSS 问题)

css - 我不能把盒子放在盒子里加上颜色不变

html - Firefox 和 IE8 不显示图像映射的鼠标悬停替代文本的问题

php - 通过 HTML 表中的 while 循环显示数据库中的信息

asp.net - 检查 css 类是否存在于代码隐藏的样式表文件中

internet-explorer - IE 的 Express js 重定向

c# - 以编程方式设置浏览器 cookie (Firefox)

css - 样式表不会在 Firefox 、 IE 和 Opera 中加载