Firefox userChrome.css窗口焦点选择器

时间:2015-03-16 19:58:25

标签: css firefox firefox-addon

当整个浏览器窗口失去焦点时,我可以在userChrome.css中使用CSS选择器来更改Firefox的文本颜色吗?

我试过了:

window:focus element { color: #aaa; }    /* does nothing */
window:active element { color: #aaa; }   /* only when something's being clicked */
window:hover element { color: #aaa; }    /* only when the cursor is over the window */
window[focus] element { color: #aaa; }   /* wishful thinking--doesn't work */
window[active="true"] element { color: #aaa; }   /* documented to work... */

还是我坚持使用Javascript?如果是这样,我可以将该脚本放入userChrome.js吗?

1 个答案:

答案 0 :(得分:1)

解决!

https://developer.mozilla.org/en-US/docs/Web/CSS/:-moz-window-inactive,此功能已更改。

现在你可以使用:

element:-moz-window-inactive { color: #aaa; }

element:not(-moz-window-inactive) { color: #aaa; }

根据Firefox窗口是否聚焦来更改CSS样式。