html - 在做出选择后使用 CSS 为 HTML 选择设置样式

标签 html css html-select

我正在寻找与 select:focus 相反的东西,它可以在做出选择后从 CSS 中为选择设置样式。

概念:

select:when not focused
{
    color:transparent;
}

最佳答案

你可以使用 :not伪类并将其与 :focus 结合起来。这样的事情应该有效:

select:not(:focus) {
  color: red;
}

这是一个演示:http://jsfiddle.net/b2rnU/1

关于html - 在做出选择后使用 CSS 为 HTML 选择设置样式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16587641/

相关文章:

javascript - 我可以使用::before content 使 div 成为可点击的链接吗?

html - 使用 list-style-position : inside 使 div 填充剩余宽度

html - CSS :before pseudo element displays one but not both on separate elements

jquery - 如何在 2 个不均匀的列中创建视差效果,以便它们在最后结束?

ruby-on-rails - 在 options_for_select 标记的选择列表中包含第一项的空白

html - 响应式 CSS 表单字段

css - 如何更改 WordPress 的 base.css

jquery - 从选择中过滤不起作用

javascript - 单击下拉菜单时如何隐藏默认 <select> <option>?

html - 如何正确使用html5 <main>元素