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

前端 未结 4 1559
一个人的身影
一个人的身影 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:57

    ::selection will override the background color once the selection is made, and will bring it back to the body{background-color: white;} once the text is deselected.
    we just have to make sure to always give a proper color and background values to both the selection and the main style.

提交回复
热议问题