首页 > 技术文章 > 使用CSS3改变选中元素背景色

olartan 2013-08-27 09:52 原文

CSS3代码如下:

/* SELECTION
----------------- */
::-moz-selection {
background: #f00533;
color: white;
text-shadow: none;
}
 
::selection {
background: #A33248;
color: white;
text-shadow: none;
}

The ::selection selector is supported in IE9+, Opera, Google Chrome and Safari.

Firefox supports an alternative, the ::-moz-selection.

W3School

 

推荐阅读