开发者

how to color background of selected text?

开发者 https://www.devze.com 2023-02-10 13:54 出处:网络
This CSS: ::selection{background:#fffada;color:#fff;} ::-moz-selection{background:#fffada;color:#fff;} Works fine in Firefox and Safari.

This CSS:

::selection{background:#fffada;color:#fff;}
::-moz-selection{background:#fffada;color:#fff;}

Works fine in Firefox and Safari.

But in or开发者_StackOverflow社区der to do the same thing in Chrome, what do we need to use?


The three you should need to implement are ::selection, ::-moz-selection and ::-webkit-selection. ::selection should work fine in the latest Webkit browsers though, including Chrome.

See http://www.quirksmode.org/css/selection.html

0

精彩评论

暂无评论...
验证码 换一张
取 消