是否有可能在Firefox中进行搜索选择风格? [英] Is it possible to style search-selection in Firefox?

查看:118
本文介绍了是否有可能在Firefox中进行搜索选择风格?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Firefox中,我可以使用


  • CTRL + F来搜索文本。 kbd> [正常搜索]

  • / [快速搜索]

  • ' [quick搜索,仅链接]


    我可以使用用户选择的文本/链接样式


    • a:focus

    • a:active $ li $ :: - moz-selection



    $ p


    • 前两种似乎只适用于用户选择/聚焦/激活的链接(通过鼠标或
    • :: - moz-selection 似乎只适用于文本我手动选择,而不是由于增量搜索选择的文本。增加的搜索匹配由Firefox以绿色突出显示。

    • 当我只在链接(')中搜索时,搜索到的部分被Firefox强调相同的绿色的颜色;而且,整个环节得到轮廓;当快速查找消失(〜5秒)时,整个链接获得:focus 样式 - 不是在此之前。



    查看截图:



    是否有任何CSS伪类可以允许搜索产生的样式,而不是用户手动选择?

    解决方案

    从这个 mozillazine论坛帖子,你可以到 about:config ,然后添加以下内容在浏览器chrome上设置不同的 ui.text * 设置:

      ui.textSelectBackground 
    ui.textSelectBackgroundAttention
    ui.textSelectBackgroundDisabled
    ui.textSelectForeground
    ui.textBackground
    ui.textForeground
    ui.textHighlightBackground
    ui .textHighligh tForeground


    In Firefox, I can search for text using either

    • CTRL+F [normal search]
    • / [quick search]
    • ' [quick search, links only]

    I can style user-selected text / links using

    • a:focus
    • a:active
    • ::-moz-selection

    However

    • the first two seem to apply only to user-selected/focused/activated links (by mouse, or TAB-navigating).
    • ::-moz-selection seems to be applied only to the text I manually selected, not the text that is selected due to incremental search. The incremental search match is highlighted by Firefox in the greenish color.
    • when I search only in links ('), the searched part is being highlighted by Firefox in the same greenish color; moreover, the whole link gets outline; when the quick find disappears (~5 secs), the whole link gets :focus style applied -- not before that.

    See the screenshot:

    Is there any CSS pseudoclass to allow styling of selection that resulted from the search, not the user hand-selection?

    解决方案

    From this mozillazine forum post, you can go to about:config and add one of the following to style different ui.text* settings on the browser chrome:

    ui.textSelectBackground
    ui.textSelectBackgroundAttention
    ui.textSelectBackgroundDisabled
    ui.textSelectForeground
    ui.textBackground
    ui.textForeground
    ui.textHighlightBackground
    ui.textHighlightForeground
    

    这篇关于是否有可能在Firefox中进行搜索选择风格?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆