Why was ::selection removed from the CSS Selectors spec, and how does its specificity work against type selectors?

前端 未结 4 1553
一个人的身影
一个人的身影 2021-02-08 07:06

Some questions about using CSS to specify the color of selected text:

  1. https://developer.mozilla.org/En/CSS/::selection says that,

    :

4条回答
  •  情书的邮戳
    2021-02-08 07:39

    The following style:

    body { background-color: white }
    

    applies to background color of your page.

    On the other hand, this rule:

    ::selection { background-color: Highlight; color: HighlightText; }
    

    applies styles when you select text on your page.

    So they do completely different things and there is no question of collision between them.

提交回复
热议问题