zcynine

 

 

很多个人网站都会改变选中区域的文字和背景的颜色,今天偶然看到的,就想了一下,想到了系统默认事件(system default),想到了jQuery的Sizzle选择器,貌似都搭不上边,其实很简单,用CSS3的伪元素选择器::selection就好了。

 

.demo::selection{color:#fff;background:#ff5e2c;}
.demo::-moz-selection{color:#fff;background:#ff5e2c;}
.demo::-webkit-selection{color:#fff;background:#ff5e2c;}

 

试着来选中这篇博文的文字吧!

 

相关链接:CSS3伪元素和伪类选择器

分类:

技术点:

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-12-19
  • 2022-12-23
  • 2021-10-01
  • 2021-07-24
  • 2021-12-23
猜你喜欢
  • 2021-11-16
  • 2021-10-28
  • 2021-08-17
  • 2021-12-19
  • 2021-12-11
相关资源
相似解决方案