📜  如何使用 CSS 更改所选文本的颜色?

📅  最后修改于: 2021-11-08 06:51:33             🧑  作者: Mango

可以使用 CSS 轻松更改所选文本的颜色 | ::选择选择器。在下面的代码中,我们在

元素上使用了 CSS ::selection并将其颜色设置为黄色和绿色背景。

下面的例子实现了上述方法:

例子:



  

    
        How to change the color of
        selected text using CSS?
    
      
    

  

    
        

GeeksforGeeks

                   

            A Computer Science portal for             geeks. It contains well written,             well thought and well explained             computer science and programming             articles, quizzes and many more.         

    
  

输出: